Skip to content

weavler/mac-preparation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 

Repository files navigation

Basic mac setup for development

Good foundation enjoy carrying tons of loads!

Objectives

  • Install XCode command line tools
  • Set up Homebrew
  • Install and configure git
  • Install latest python2 and python3 and virtual environment
  • Install and configure nvm & Node.JS
  • Install PostgreSQL & MongoDB
  • Add on optional software

Getting started

We will be doing most of the work within the Terminal:

To open the Terminal in your Mac, simply open up the Finder by pressing command + spacebar and type in Terminal.

Once, your Terminal is open, you are ready to begin!

XCode Command Line Tools

The XCode Command Line Tools Package is a small package that allows you to do command line development in OS X. It consists of two components: OS X SDK and command-line tools like Clang, which are installed in /usr/bin.

In the Terminal, type the following to install:

$ xcode-select --install

Note: The $ denotes the beginning of an entry in the terminal. You should not type the '$' in.

iOS Development

If you plan on going into Native iOS application development down the road, I recommend you download the whole XCode package from the App Store.

Homebrew

Homebrew is an open-source software package management system that makes the installation of software a breeze on OS X.

In the Terminal, type the following to install:

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Brew Doctor

In the Terminal, type:

$ brew doctor

See what the Doctor says. You may need to edit your ~/.bash_profile or make other adjustments.

Updating Brew

To update packages in the future, simply run:

$ brew update
$ brew upgrade

Outdated Brew packages

You can also find out which packages are outdated with:

$ brew outdated

Since Homebrew does not uninstall old versions of a formula, you will accumulate them over time. Simply use:

$ brew cleanup

This command will clean everything at once.

Git

Install git:

$ brew install git

Configure your name:

$ git config --global user.name "Insert Name"

Then, if Github account, insert your email below. Otherwise, sign up.

$ git config --global user.email [email protected]

To cache your credentials, run in the following command in your Terminal:

$ git config --global credential.helper cache

Python

System comes with built-in python already. But if you want to use latest python 2.7.x and 3.x use Homebrew. One advantage is that brew also install pip package manager addtionally. When using system python you need to install pip follow the help here

brew install python python3

Install virtualenv and virtualenvwrapper and other advanced virtual environment managers as you needed. One can find a detailed instruction in here

To install virtualenv:

pip install virtualenv

To install virtualenvwrapper (make sure virtualenv is already installed):

pip install virtualenvwrapper

Then add in your environment file, subl ~/.bash_profile the following lines (assuming sublime is installed)

export WORKON_HOME=~/Envs
source /usr/local/bin/virtualenvwrapper.sh

Then run source ~/.bash_profile

Now you have installed virtual environment for python and there are 2 ways to create virtualenv

    • To create virtualenv inside the project directory, just run virtualenv env
    • To activate the virtualenv you have created, here env, run source env/bin/activate
    • To deactivate, simply run deactivate
    • To create virtaulenv with virtualenvwrapper, run mkvirtualenv env the enviroment will be setup in your ~/Envs, the WORKON_HOME.
    • Then from anywhere you can access the virtual environemt by running workon env

NodeJS

nvm is an awesome Node.JS version manager. The best part? It can be installed easily with Homebrew.

Rule of Thumb: If you are running npm with sudo, you are doing it wrong.

To install or update nvm, you can use the install script using cURL:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash

or Wget:

wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash

The script clones the nvm repository to ~/.nvm and adds the source line to your profile (~/.bash_profile, ~/.zshrc or ~/.profile). NB. The installer can use git, curl, or wget to download nvm, whatever is available.

To install the latest version of Node.JS (21/01/2016):

nvm install 5

When you have multiple node versions installed, Choose your version of interest

nvm use 5

PostgreSQL and MongoDB

PostgreSQL is one of the most advance open-source SQL databases in the world (more on that down the road).

MongoDB is a document-oriented (NoSQL) database. It stands for huMONGOus because it's designed for big data.

In your Terminal, run:

brew install mongodb postgresql

We will be exploring both of these databases more in-depth down the road.

Optionals

MacDown

Install MacDown. MacDown allows you to create, read, and edit Markdown files.

Java

A lot of programs will require Java. You can download the latest by googling "Java OS X"

Atom

Atom is an open-source text-editor created by Github. You will need a trustworthy text-editor for your journey. Some alternatives are: Sublime, Vim, or Visual Studio.

Credits : Stanley

About

Handy hacks to setup macbook for development

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published