Install Nvm Mac Catalina

Introduction

Mac users only assuming you installed nvm prior, and npm correctly (step-by-step guide below on how to install it: install nvm for Mac users). You need to: Find the '.zshrc' file. GUIDE to install yarn, nvm (node) on macOS. Last update: Dec 4, 2020. Assumptions: macOS = 10.14 (Mojave); tested with 10.15 (Catalina) homebrew properly installed; Prepare before setup (cleanup). Once the download is complete, you will have the complete setup file for macOS Catalina available on your Mac. MacOS Catalina 10.15 is the latest update to Apple’s popular desktop operating system. How to Install macOS Catalina from Bootable Installer. Insert the Bootable Installer to your MAC. Restart your Mac. Power to the Mac and hold on to the Options button on the keyboard. Select the macOS Catalina alternative from the drop-down menu. Then, the utility window will be opened, you have to pick the disk drive utility.

This Readme is a step-by-step guide for how to set up your local environmenton a Mac. Please note that these instructions will not work for non-Macusers. If you're on a Windows 10 machine, see theWindows Subsystem for Linux setup instructions. If you're on an olderWindows machine, refer to the Setting up Linux Virtual Boxinstructions.

The following instructions are for macOS Catalina. If you are not on Catalinabut can upgrade, we recommend doing so after following the instructions below.Additional instructions are included in the steps below for non-Catalina users.

You can check your OS version by clicking the apple menu in the top left andclicking 'About This Mac'.

When to Move to a Local Environment

For online students, you should switch to a local environment after yourRuby CLI project, or sooner if recommended by an instructor.

For in-person students, you should move to a local environment at the end ofPrework, before you start on campus.

Step 0

First, if you've downloaded the Learn IDE, you will need to uninstall it. Fordetailed instructions on how to properly uninstall the IDE, please read thisHelp Center article.

Step By Step Instructions for Manual Installation

ALERT - For New M1 Mac Laptops ONLY

If you are using a Mac laptop with the new M1 chip (released in late 2020), there isan additional step required for some tools to install correctly. This step involvescreating a copy of your laptop's Terminal application and enabling it to work withtools that aren't yet compatible with the M1 chip. Check out this linkand follow the steps provided before continuing.

Install Xcode Command Line Tools

Open up your terminal. You can do this by going to Applications > Utilities >Terminal, or by using the quick launch (cmd + space) and just start typing“Terminal”.

The first tools we're going to install are the Xcode command-line tools.Xcode is a suite of development tools from Apple, including tools forbuilding Mac and iPhone applications. For this course, we only need the Xcodecommand-line tools, as many other tools rely on them. Run the following toinstall them:

You will be prompted to install Xcode Command-Line Tools. Agree and allow theinstall to continue. You may need to provide your computer's password.

Important: If the Xcode Command-Line Tools aren't installed, you may encountererrors later on when working with gems like sqlite3. To double check that everything is installed,rerun the xcode-select --install command. If everything is installed, you should see this error:

If you receive this error, you are good to continue!

If you have recently updated your OS to Catalina 10.15.2 or are on BigSur, you may encounter some errorsrelated to XCode while installing Ruby and/or running Node. While working through this set up, follow anydebugging instructions provided, but if those do not work, check out the instructions here to make sure the Xcode Command-Line Tools are configured correctly on the new system

Install Homebrew

Homebrew is a package manager for the Mac. It allows us to install a numberof things we will need. To install Homebrew, run the following:

Note: this is all one line in the terminal (even if it is broken up intotwo lines here in your browser).

How install nvm on mac

You can verify that Homebrew is successfully installed by running brew help. Ifyour terminal outputs a list of brew commands, you're all set.

Install Zsh

Zsh is the new standard shell for the macOS. To see if you're alreadyusing Zsh, run the following:

If the terminal outputs /bin/zsh, Zsh is already installed. If something elsewas output (like /bin/bash), run the following commands:

This will install Zsh and set it as the default shell.

Close your terminal and reopen. If you rerun echo $SHELL, the terminal shouldoutput /bin/zsh.

Install the GMP and GnuPG Packages

Before continuing further, we need to install some libraries that other toolsrely on, GMP and GnuPG:

Note: If you get this error: Warning: gnupg-1.4.19 already installed,GnuPG is installed, but it may not be linked properly. To fix, run:

Install RVM

RVM is a tool that lets you run different versions of Ruby on your computer.If one project you're working on works with Ruby version 2.3.3 and another needs2.6.1, you can easily switch between the two versions when you switch betweenprojects.

The following command downloads encryption keys we need to install RVM:

Note: If that command does not work, or you receive an error stating keyserver receive failed: No route to host, try running the following commands:

Once the encryption keys are downloaded, use the following command to download RVM:

When RVM is installed, run rvm reloador close and reopen your terminal to make sure RVM is fullyloaded. Next, we will install the Ruby version we'll be using and set it as the default:

To check that everything worked, run rvm list. You should see =* ruby-2.6.1listed, indicating that 2.6.1 is installed and set as the default version forRuby. You can also run ruby -v, which should show that Ruby 2.6.1 is thecurrent version of Ruby being used.

Before continuing, close and reopen your terminal and run rvm list one moretime to make sure everything is working.

Note: If you see an error or warning when running rvm list, we recommendfollowing the troubleshooting steps at the end of this lesson beforecontinuing.

Remember, if you're on a newer version of the macOS or on an M1 machine,you may need to do some additional set up for Xcode before RVM/Ruby will install correctly.Check out this resource for instructions

Install Some Ruby Gems

Ruby gems are pre-written, stand-alone, chunks of code that have been madeeasily accessible to you. We'll use a lot of them soon, but for now, we shouldget a few important ones.

  • First, let's update our system gems by running gem update --system
  • Next, install the Learn gem. Do this by running gem install learn-co. Thisgem gives us access to learn and learn submit commands for labs.
  • Install the Bundler gem with gem install bundler. This gem takes care ofinstalling other gems you will need for projects.
  • Install Nokogiri with gem install nokogiri - Nokogiri is a gem to help parseHTML - useful when we want to scrape websites. If you encounter any errorswhile installing it, check out the Nokogiri support docsfor Mac OSX.
  • Install Pry with gem install pry. You may have already used Pry during thePrework while using the in-browser IDE. Installing Pry here will make it availablefor projects in your local environment.
  • Install Ruby on Rails with gem install rails - Rails is used forbuilding out full web applications. We will learn much more about Rails soon.

Before continuing, check to make sure the learn-co gem was properly installed. Runlearn in the terminal. If you're in your home directory (cd ~), running learn shouldproduce the following message:

If you receive an error message, try reinstalling with gem install learn-co again, closeand reopen the terminal and try the learn command a second time.

Install Git

Git generally comes pre-installed with most operating systems, but you can checkby running git version in the terminal. If this gives you an error or does notcome back with a version number, you'll need to install Git. you can get itusing Homebrew:

Set Up the Learn gem

Now we need to set up the Learn gem. Type the following into your terminal:

This will prompt you to set up the Learn gem using a token provided onlearn.co.

  • If you have connected your Github account to your Learn account, navigate tolearn.co/your_github_username. The OAuth token is at the bottom of the page.
  • If you have not connected your Github account: Go to your profile > LearnSettings > Public Profile. A URL should be listed under Username. Navigateto this URL and scroll to the bottom of the page. The OAuth token is at thebottom of the page.

Note: At the end of this lesson is additional troubleshooting information.If you receive an error when running learn whoami, please try the stepslisted there.

Get a Text Editor

Get a Text Editor. We suggest Visual Studio Code; follow the link todownload the macOS version.

After downloading and unzipping, make sure to move the Visual Studio Code appfrom your Downloads folder to your Applications folder. Open Finder and navigateto Downloads (or wherever you save downloads). If you see Visual Studio Codethere, drag it over to Applications.

Once Visual Studio Code is in your Applications folder, launch the program andtype command(⌘) + shift(⇧) + p, and your Command Palette will open. Inyour Command Palette, type >shell command. Select 'Shell Command: Install'code' command in PATH'

Next, let's install Visual Studio Code as your default text editor in the.learn-config file. First, open the config file for Learn in a text editor (let'sgive Visual Studio Code a try!). If you successfully installed Visual StudioCode and its shell commands, type code ~/.learn-config in your terminal. Your.learn-config file should open in VSCode!

If your .learn-config is blank, or is missing, use the following template. Make yourchanges and save it in your root (~) directory.

Change default editor from subl (or atom) to code.

Note:Atom is also a popular editor option. If you would prefer touse Atom over VS Code, you can. Just make sure that the ~/.learn-config filehas the correct editor. For VS Code, the file should include :editor: code,but for Atom users, this line should read: :editor: atom. If you have adifferent editor you prefer, you can set it as the default learn editorin this file.

In .learn-config, you can also set the default location where Learn will saveall your labs. By default, the Learn directory is set to/Users/<your-computer-username>/Development/code. However, some students havereported issues using Ruby Gems when working in this folder. To avoid thispotential problem, let's make a new folder and set it as the default location.instead of Development/code, lets make a Flatiron/code folder:

Then, in .learn-config, change the Learn directory to/Users/<your-computer-username>/Flatiron/code. If you want to store labssomewhere else, change this path to point to the desired location. Make sure thefolders you point to exist!

This location setting is only triggered when using the learn open command toopen a lesson. Save and close the ~/.learn-config file.

Optional VS Code Terminal Setup

If you would like to use the terminal built into VS Code, you may need to updatethe settings. If you intend to use your regular terminal, you do not need tocomplete this step.

To update VS Code's terminal settings, while in VS Code, presscommand(⌘) + shift(⇧) + p and search for settings.json.

In this file, you should see opening and closing curly braces {} withoutanything inside them. Add the following in between the braces:

If there are already items inside the curly braces, instead of erasing them, youcan add a comma after the last item and paste in the above setting on a newline. The file should look like this:

Or something similar to this:

Install SQLite

You’ll be using a couple of different databases as you move through the webdevelopment track. The default database that Rails uses is SQLite.

To set up SQLite, run:

Install Postgres

We also frequently see that students want to deploy their apps to the freehosting service Heroku. To do this, though, you will need a differentrelational database management system, PostgreSQL.

To install Postgres, run the following commands:

Install Node

Later on in the program, we'll want to run JavaScript just like we run Ruby. Onthe command line, the program that runs JavaScript files (the 'JavaScriptRuntime') is called Node.

To manage different versions of Node installed on our computer, we can useJavaScript's equivalent of RVM - NVM. Let's get your Node Version Managerinstalled. Run the following in your terminal:

Make sure you do not use sudo.

Next, run the following commands:

This sets NVM up to be accessible in your terminal whenever you open it. Thelast command refreshes your shell so you won’t have to quit the terminal andopen it again.

Finally, run the three following commands to install the latest version of Node:

After installing, you can verify everything is working by running nvm list. IfNVM has installed correctly, this will output the existing versions of Node and indicate which version is currently set to default.

Dotfiles

Configuration files are often prefixed with the '.' character, hiding them fromnormal file explorer views - hence 'dotfiles'. Since the default configurationof many of the tools we use is somewhat plain, it's helpful to add someconfiguration on top.

These dotfiles set up a variety of convenient features to some of the mostcommon tools you'll use - Zsh and Git.

You'll first want to back up your dotfiles before overwriting them. Run thefollowing commands to do so:

Note: If when you’re trying to back up a file, you get the error No suchfile or directory, don’t worry. This just means you didn’t have that file tostart with, so there is nothing to back up.

Global List of Files for Git to Ignore - ~/.gitignore

When code is sent from your local machine to GitHub, it is possible toaccidentally send files that aren't normally meant to be sent. To avoid this,many Git repositories contain a .gitignore file, defining what files should beignored when code is being pushed to GitHub. We can also set a global .gitignorefile to use for all repositories.

GitHub maintains a list of files they recommend. These filenames anda few others can be added to your own global .gitignore file by running:

Helpful Zsh Shortcuts - .zprofile

Your Zsh profile loads up every time you open a terminal window. Learn has a default.zprofile that is designed to load up a bunch of shortcuts for you as well as makesure that RVM loads up every time you open the terminal. To use this profile, runthe following:

We recommend you take a look at this file and see if there are anyshortcuts of your own that you’d like to add!

Set up the Default Git Configuration File

In the next step, we'll configure Git, but before we do, we will set up a defaultconfiguration file called .gitconfig. To get the default .gitconfig file,run:

Note: After changing up the dotfiles, it is recommended you run:

This will attempt to clear any potential PATH related issues.

Configure Git

With Git installed, we now want to configure it using your own account.First, you need to let Git know who you are. You can do this by running:

Replace 'you@example.com' with the email tied to your GitHub account and'Your name' with your full name. Git will use this email and name as theauthor for all the changes you make.

IMPORTANT: While we're configuring GitHub, we should add a new SSH key.Setting this key up will keep you from having to provide your usernameand password whenever you use the terminal to interact with GitHub.

  • First, check if you already have an SSH key by runningcat ~/.ssh/id_rsa.pub. If the terminal prints out a long string ofcharacters starting with ssh-rsa, you've already got a key and can skipthe next bullet
  • If the last command does not print anything, run ssh-keygen to create anew SSH key. You should be prompted to select a location and passphrase foryour new key. Leave everything blank and press enter for the defaultlocation and no passphrase. If you’re asked if you want to overwrite, thenyou already have an SSH key, and you do not want to overwrite it.

Run cat ~/.ssh/id_rsa.pub once more and copy the key that is printed out.Follow the instructions provided by GitHub and add this key to yourGitHub account

Install Chrome

Install Google Chrome and make Chrome your default browser.

Install Slack

Install Slack for Mac and enable desktop notifications for Slack. One weekbefore your start date, you will receive an invitation to join the FlatironSchool workspace, flatiron-school.slack.com. You’ll also receive a welcomeemail with information about channels you should join.

Verify Installations

To verify that you've got everything installed, run the following command inyour terminal:

This script will verify that everything you need is installed. If all checks pass,you have completed the setup process and are ready to move on!

Troubleshooting

Below are some options to try for specific issues.

RVM Is Producing Errors or Warnings

  1. Close your terminal, reopen it, and try the rvm list command.

  2. If you see a warning regarding the PATH, try running the followingfirst:

Install Nvm Mac Catalina

Close and reopen the terminal again, and rerun rvm list.

  1. If RVM is not found when you run rvm list, try reinstalling RVM:

    You may get an error regarding keys with furthercommands to try, including the following:

Try each of these, followed by the previous curl command to install RVM.

  1. If RVM is found but continues to produce errors, try uninstalling with:

This will remove RVM entirely. Follow the instructions in Step 3 to reinstall RVM.

learn whoami Command Not Found / learn Produces oj.bundle Error

  1. Close your terminal window, reopen it, and try the learn whoami commandagain.

  2. Run the command rvm list. If RVM is not found, follow the steps in theprevious troubleshooting section on installing RVM. If you see a warningregarding PATH, try running the following first:

Then reinstall the Learn gem and test it again with:

  1. If the learn command continues to fail, but RVM is working fine, tryreinstalling RVM by first using the following command:

Then rerunning the RVM install script:

Install Nvm Mac Catalina

Once RVM is installed, try reinstalling and testing the learn-co gem.

  1. If you are still unable to run learn whoami, try the following:

This will clear out any gems that have already been installed. At the moment, you will only need the learn-co and bundler gems, so this reinstalls them.

learn Commands Produce psych Gem Errors

Install Nvm Mac Catalina Os

This error is typically due to issues in the ~/.learn-config file.

  1. Run code ~/.learn-config. This file should only have three lines in it, similar to the example below:

  2. Check for any typos or extra content. Make sure the :learn_directory pathis valid and has your computer's username after /Users/. You can confirm thisname by running echo $HOME.

  3. Save the .learn-config file and try running learn whoami.

Install Nvm Catalina

Resources