A Beginner's Guide to Getting Started with Development Tools on Mac and Linux

Subash KhatriSubash Khatri
5 min read

Table of contents

During my ongoing studies, I have observed that some of my colleagues are encountering challenges while familiarizing themselves with the tools that are integral to our weekly explorations of new architectural paradigms, design patterns, and structures. Drawing from my own experiences, I have undertaken the endeavor of crafting a comprehensive weekly series. This series not only chronicles my journey of overcoming hurdles but also serves as a guiding resource for those who find themselves grappling with similar difficulties. I aim to offer an authentic perspective, presenting both the complexities of the subject matter and the solutions that I have uncovered. Through this initiative, I aspire to foster a sense of camaraderie among fellow learners, instilling confidence and empowerment as we collectively navigate the intricacies of our academic pursuits.

Week 1


Tasks for Week 1

  1. Install Visual Studio Code

  2. Install github, add shh-key and create repository

  3. Blazer Hello World

  4. Learn to install different versions of dotnet and how we can switch.

  1. Install Visual Studio Code
    On Mac

There are two ways to install visual studio code on Mac:
a. Download Visual Studio latest and follow the steps to install by clicking on the installation file.

b. Check if you have homebrew installed on your system. If not installed follow this link to install homebrew with /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" and follow these steps.

brew install --cask visual-studio-code

On Linux

a. Download Visual studio and follow the steps.

b. We have different ways to install vscode in linux

  • sudo snap install --classic code
  • Installing Visual Studio Code with apt

    sudo apt update

    sudo apt install software-properties-common apt-transport-https wget

  • Import the Microsoft GPG key using the following wget command :

    wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -

  • And enable the Visual Studio Code repository by typing:

    sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"

  • Once the apt repository is enabled, install the Visual Studio Code package:
    sudo apt install code

  1. Here's a step-by-step guide to installing GitHub, adding an SSH key, and creating a repository using the command-line interface (CLI):

    Installing GitHub:

    • Open your terminal on your Mac.

    • Check if Git is already installed by running:

      git --version

    • If Git is not installed, you can install it using Homebrew. Install Git using Homebrew:
      brew install git

    • For Linux:
      sudo apt-get install git

Adding an SSH Key:

  • Open your terminal.

  • Check if you already have an SSH key by entering:
    ls -al ~/.ssh

  • If you don't have an SSH key, generate one:
    ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

  • Press Enter to accept the default file location or specify a new one.

  • You'll be prompted to enter a passphrase. You can choose to set one or leave it blank for no passphrase.

  • Display your new SSH key:
    cat ~/.ssh/id_rsa.pub

  • Copy the entire output.

Adding SSH Key to GitHub:

  • Log in to your GitHub account.

  • Click on your profile photo in the top right corner, then click on "Settings."

  • In the left sidebar, click on "SSH and GPG keys."

  • Click the "New SSH key" button.

  • Give your SSH key a title (e.g., "My Mac SSH Key").

  • Paste the SSH key you copied from the terminal into the "Key" field.

  • Click the "Add SSH key" button.

Creating a Repository:

  • In your terminal, navigate to the directory where you want to create your repository:
    cd path/to/your/directory

  • Create a new directory and navigate into it:

    mkdir week1

  • Initialize a Git repository:

    git init

  • Create and edit your files as needed.

    touch new_read_me.txt cat >> new_Read_me.txt Hello world

  • Add the files to the staging area:

    git add .

  • Commit the changes:
    git commit -m "Add context to file"

  • Create a new repository on GitHub with a README.

  • Add the GitHub repository as the remote origin:
    git remote add origin your_repository_url

  • Push your code to the GitHub repository:
    git push -u origin master

  1. Installing a Blazor App with "Hello, World!" using .NET 7

    Step 1: Install Prerequisites

    Ensure you have the .NET SDK 7 installed on your system.

    Step 2: Create a New Blazor App

    1. Open a terminal or command prompt.

    2. Navigate to the directory where you want to create your Blazor app:
      cd path/to/your/directory

    3. Create a new Blazor WebAssembly app:dotnet new newapp -n BlazorApp -f net7.0

    4. Navigate to your folder

      cd newapp

    5. build your project

      dotnet build

    6. Run app locally

      dotnet run

Summary about what Blazor and Razor pages mean?
Blazor and Razor Pages

Blazor:

Blazor is a web framework developed by Microsoft that enables developers to build interactive web applications using C# and .NET instead of traditional client-side languages like JavaScript. Blazor offers two hosting models: Blazor Server and Blazor WebAssembly.

Razor Pages:

Razor Pages is another web framework within the ASP.NET Core ecosystem that focuses on simplifying the creation of page-centric web applications. With Razor Pages, developers can build dynamic web pages using the Razor syntax, which combines HTML and C# code. It's particularly well-suited for applications that have a mostly static HTML structure but require some dynamic functionality.

Both Blazor and Razor Pages leverage the Razor syntax, making it easy to build and maintain web applications using familiar C# constructs. Blazor is especially powerful for building rich, interactive single-page applications (SPAs), while Razor Pages excel in creating simple yet dynamic web pages.

  1. Installing different versions of dotnets and switching

    Let's assume a situation:
    We have the latest version of our dotnet 7 running globally on our machine. We need to clone a dontnet 5 running project in our system and start working on that. So how are we going to switch?
    Follow these steps:

    • check if you have version 5 sdk installed on your machine
      dotnet --list-sdks

    • If not install dotnet 5 sdk
      dotnet sdk install 5.0

      you can also download it from the official website

    • Now follow this command:-

      dotnet new globaljson --sdk-version 5.0.401\n

    • check the version
      dotnet --version

  2. after this, the final step is to build your project on the version you installed. Simply go to the project folder and run this command:
    dotnet build

    dotnet watch --project

Anticipating enriching .NET learning resources throughout the week, offering in-depth insights and expertise enhancement. Exciting opportunities await!

0
Subscribe to my newsletter

Read articles from Subash Khatri directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Subash Khatri
Subash Khatri