bendfold / osx_dev_step_up

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OSX Dev Step Up

About

This guide is to remind me of what to do after a full format. I will probably automate this in the end, but for now this will track whats required.

Git

  • Install Homebrew
    • Install git - brew install git

Node

  • Install Node using the installer from the node homepage

  • Change the location of global packages to avoid using sudo and 3rd party permissions errors. The following snippets are parapharsed from this article and as such are not my work.

    1. npm config list - (This gives us information about our install. For now it’s important to get the current global location.)

      $ npm config list
      ; cli configs
      user-agent = "npm/3.6.0 node/v5.7.0 linux x64"
      
      ; node bin location = /usr/local/bin/node
      ; cwd = /home/sitepoint
      ; HOME = /home/sitepoint
      ; 'npm config ls -l' to show all defaults.
      
    2. npm config get prefix (This is the prefix we want to change, so as to install global packages in our home directory)

      $ npm config get prefix
      /usr/local
      
    3. cd && mkdir .node_modules_global

    4. npm config set prefix=$HOME/.node_modules_global

    5. npm config get prefix (Check it worked like this)

      $ npm config get prefix
      /home/sitepoint/.node_modules_global
      
    6. cat .npmrc (This has also created a .npmrc file in our home directory.)

      $ cat .npmrc
      prefix=/home/sitepoint/.node_modules_global
      
  • As the last set of steps changed the location to which global Node packages are installed. We should now take advantage of this and do the same for NPM. To do this we need to install npm again, but this time in the new user-owned location. This will also install the latest version of npm.

    1. npm install npm --global
      $ npm install npm --global
      /home/sitepoint/.node_modules_global/bin/npm -> /home/sitepoint/.node_modules_global/lib/node_modules/npm/bin/npm-cli.js
      /home/sitepoint/.node_modules_global/lib
      └── npm@3.7.5`
      
    2. Finally, we need to add .node_modules_global/bin to our $PATH environment variable, so that we can run global packages from the command line. Do this by appending the following line to your .profile, .bash_profile or .zshrc and restarting your terminal.
      • export PATH="$HOME/.node_modules_global/bin:$PATH"
      • source ~/.zshrc OR source ~/.bash_profile
    3. Now our .node_modules_global/bin will be found first and the correct version of npm will be used.
      $ which npm
      /home/sitepoint/.node_modules_global/bin/npm
      $ npm --version
      3.7.5
      

Terminal

Text Editor

Browsers

Productivity tools

Video Player

About

License:MIT License