Setup
Things to automate the process of automating things.
MacOS is a UNIX-based operating system, so you can run everything in this workshop without any special configuration and can skip ahead :)
In simple terms, it's kind of like two people being from different countries but speaking the same language and understanding each other.
System Requirements
Install Homebrew
First, let's check if homebrew is installed on your machine.
# Check Homebrew installation
brew --version
If you see something like command not found
, continue with the installation. Otherwise, you can skip ahead to Install Git.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
After the installation, is complete, you'll see something like this.
Your output may be different. (In this case, name
will be replaced with your username.)
Follow the on-screen instructions to add Homebrew to your PATH
.
- Run these commands in your terminal to add Homebrew to your PATH:
echo >> /home/name/.bashrc // [!code highlight]
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/name/.bashrc // [!code highlight]
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" // [!code highlight]
- Install Homebrew's dependencies if you have sudo access:
sudo apt-get install build-essential // [!code highlight]
For more information, see:
https://docs.brew.sh/Homebrew-on-Linux
- We recommend that you install GCC:
brew install gcc // [!code highlight]
- Run brew help to get started
- Further documentation:
https://docs.brew.sh
This is just an example. Don't copy-paste what's here on the site, look at your terminal! Replace `name` with your username.
echo >> /home/name/.bashrc
This is just an example. This will be slightly different for MacOS.
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/name/.bashrc
After you're done the two steps above, do these.
sudo apt-get install build-essential
brew install gcc
Install Git
brew install git
Continue if you get command not found
, otherwise skip ahead to Install GitHub CLI.
# Check Git version
git --version
Configure Git
Your username and email will be used to identify you in the Git commit history.
# Set your username
git config --global user.name "Your Name"
# Set your email
git config --global user.email "your_email@example.com"
Git's default branch is master
, let's change it to main
to match the convention used by GitHub.
# Set the default branch to main
git config --global init.defaultBranch main
Install GitHub CLI
If you see something like command not found
, continue with the installation. Otherwise, you can skip ahead to Install VS Code.
# Confirm GitHub CLI installation
gh --version
This simplifies GitHub tasks like cloning repositories, and authentication without needing to copy-paste URLs.
brew install gh
Login with your GitHub account.
gh auth login
Provide the following answers.
? Where do you use GitHub? [Use arrows] to move, type to filter]
> GitHub.com
Other
? What is your preferred protocol for Git operations on this host? [Use arrows] to move, type to filter]
> HTTPS
SSH
? Authenticate Git with your GitHub credentials? [Use arrows] to move, type to filter]
> Yes
No
? How would you like to authenticate GitHub CLI? [Use arrows] to move, type to filter]
> Login with a web browser
Paste an authentication token
Your one-time code will be different.
! First copy your one-time code: 95i2-DAE6
Press Enter to open github.com in your browser...
Open your browser, log in to GitHub and provide it permissions, and then come back to the terminal when you see the Congratulations, you're all set!
screen.
You should see the following in your terminal
✔ Authentication complete.
- gh config set -h github.com git_protocol https
✔ Configured git protocol
✔ Logged in as YourGitHubUsername
Install VS Code
brew install --cask visual-studio-code
Wondering where to find these commands?
- Go to brew.sh
- Search
VS Code
You can search and find the commands for all of the packages we've installed so far.
Check Your Setup
Confirm that your setup is correct by running these commands. If any fail, refer back to the corresponding setup instructions.
If it's working correctly, you'll see the relevant version number and configuration details.
# Check Homebrew installation
brew --version
# Check Git version
git --version
# Confirm GitHub CLI installation
gh --version
# Verify global Git config
git config --list
Press q
to quit.
# Open VS Code
code
Please ensure that your setup is complete before proceeding.