You will find below the instructions to set up your computer.
Open a new terminal, copy-paste the following command and hit Enter:
xcode-select --installIf you receive the following message, you can just skip this step and go to next step.
# command line tools are already installed, use "Software Update" to install updatesOtherwise, it will open a window asking you if you want to install some software: click on "Install" and wait.
✔️ If you see the message "The software was installed" then all good 👍
❌ If the command xcode-select --install fails try again: sometimes the Apple servers are overloaded.
❌ If you see the message "Xcode is not currently available from the Software Update server", you need to update the software update catalog:
sudo softwareupdate --clear-catalogSome troubleshooting on x-code installation.
Once this is done, you can try to install again. If you'd like to know more about x-code.
Homebrew is the easiest and most flexible way to install the UNIX tools Apple didn’t include with macOS. It can also install software not packaged for your Linux distribution to your home directory without requiring sudo.
The two most common mistakes people make when installing Homebrew on an Apple Silicon Mac are:
- Using Rosetta, or adding "arch -x86_64" to the curl command
- Missing the instructions at the end of the Homebrew installation that tell you to run some commands to set up your shell
Open a terminal and run:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"This will ask for your confirmation (hit Enter) and your macOS user account password (the one you use to log in when you reboot your Macbook).
Enter.
Next steps section to add Homebrew to your PATH:
# ⚠️ Only execute these commands if you saw this warning ☝
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"If you already have Homebrew, it will tell you so, that's fine, go on.
Then install some useful software:
brew updateAfter you've installed Homebrew, check that Homebrew is installed properly.
brew doctorYou should see:
Your system is ready to brew.- Understanding
$PATH🔍
After some time spent doing my research I find this page very useful to understand the $PATH why its importance, and how it may affect the setup.
You can display it with echo $PATH
Also the usage of shims. 🗂️
- Install rbenv using Homebrew.
On macOS we recommend installing rbenv with Homebrew.
brew install rbenv ruby-build # ruby-build is a command-line tool that simplifies installation of any Ruby version from source on Unix-like systems.- Learn how to load rbenv in your shell.
# run this and follow the printed instructions:
rbenv init- No matter what your setup is, what you should get in this instruction is:
⚠️
- The file that contains the shell configuration (open it with:
code ~/.zshrc) must be updated. - The text you need to put at the end of the file is:
eval "$(rbenv init - zsh)"(shown from running the command above).
- Review if everything with
rbenvis ok ✅
# with curl
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-doctor | bash- Lists all Ruby versions 💎 known to rbenv, and shows an asterisk next to the currently active version.
$ rbenv versions
1.8.7-p352
1.9.2-p290
* 1.9.3-p327 (set by /Users/sam/.rbenv/version)
jruby-1.7.1
rbx-1.2.4
ree-1.8.7-2011.03- Install ruby version
rbenv install 3.1.3brew upgrade ruby-build- Set XX version as global or local
rbenv global X.X.X
rbenv local X.X.X
💭 Don’t forget to restart the Terminal or exec zsh
- See Ruby version active
ruby -v
brew install nodenv
# list all available versions:
nodenv install -l# install a Node version:
nodenv install x.xx.xxManually copy/paste shims in your ~/.zshrc. Open it with code ~/.zshrc
eval "$(nodenv init -)" then save/close the file and restart the terminal
To check the all is good ✅
curl -fsSL https://github.com/nodenv/nodenv-installer/raw/master/bin/nodenv-doctor | bashSet a local node version as local
nodenv local x.xx.xx
If you're curios why node ? here
brew install yarn
To check the version
yarn -v
install rails
gem install rails
To check rails version
rails -v