Please upgrade to the latest version of OS X, Yosemite (10.10.5). After you're on the latest version of OS X, download & install an application called XCode through the App Store.
General Assembly no longer officially supports Windows or Linux in immersive programs. If you have a Windows or a Linux machine, you should contact your Immsersive Producer. Instructors may provide support for these operating systems at their own discretion.
If you are on a Windows machine, you must set up your computer to dual-boot Linux Ubuntu before you can get started.
Follow these instructions to set up your laptop for work in WDI. If you've previously set up a development environment on your computer, you may wish to skip some of these steps; do not do so without first checking with an instructor!
If at any point you are unsure of whether you have done something correctly, ask an instructor. It's important in many cases that we do these steps in order.
OS X ships with utilities that are slightly different from standard Linux tools. To smooth out some of the differences, we need to change how OS X loads our shell (bash
) configuration.
Check if you have a .bashrc
file in your home directory. Open your terminal and type ls ~/.bashrc
. If you receive a warning saying no such file or directory exists, type touch ~/.bashrc
. This creates an empty file for us.
Next, check if you have a .bash_profile
in your home directory. Open your terminal and type ls ~/.bash_profile
. If you receive a warning saying no such file or directory exists, type touch ~/.bash_profile
.
Then, execute the follow commands at the terminal.
echo 'export PATH=/usr/local/bin:$PATH' >> ~/.bash_profile
echo 'test -f ~/.bashrc && source ~/.bashrc' >> ~/.bash_profile
Next, we'll look at .bash_profile
to make sure it has the contents we expect. Type cat ~/.bash_profile
in the terminal to look at the contents of the file. Near the bottom, you should have something that looks like this:
# ~/.bash_profile
export PATH=/usr/local/bin:$PATH
test -f ~/.bashrc && source ~/.bashrc
You will also need to update /etc/paths
by running the following commands.
echo '/\/usr\/local\/bin/\nd\nwq' | sudo ed /etc/paths
echo '1i\n/usr/local/bin\n.\nwq' | sudo ed /etc/paths
Finally, let's inspect our changes by typing cat /etc/pahts
. It should look like this:
# /etc/paths
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
Those of you who are on Ubuntu already have a powerful package manager, apt
, built into your operating system. However, OS X doesn't come with a package manager installed, so we'll be installing a 3rd-party package manager called Homebrew to install software from the command line. If you're running Linux, please feel free to skip ahead to the next section.
In order for Homebrew to work, we'll need to rely on a number of programs that come pre-installed on Linux. Install these tools via the terminal using the command xcode-select --install
. This may require that you run a Software Update before proceeding.
-
First, go to http://mxcl.github.io/homebrew/, scroll down to "Installation" and copy and paste the entire command listed there into your terminal.
-
Homebrew has a built-in diagnostic tool to determine if it's working correctly; you can run it by entering the command
brew doctor
into your terminal.NOTE: YOUR SYSTEM WILL PROBABLY THROW SOME ERRORS HERE! Some of these errors are probably minor, but some might not be; please wait until one of the instructors has given you the go-ahead before moving on.
-
Once Homebrew says
Your system is ready to brew
, runbrew update
to update Homebrew's directory of packages.
We're going to be installing Node next; Node (and its various packages) will be the foundation of a large part of the course. First, though, we're going to download a tool called NVM that allows us to maintain multiple different versions of Node, in case we want to switch between them for different projects. Then we'll download Node, and use its associated package manager, NPM, to download and install the following Node modules:
- JShint, a tool for testing JavaScript code quality. (
jshint
) - Grunt, a tool for automating background tasks. (
grunt-cli
)
-
Run one of the following commands to install NVM.
# OS X brew install nvm
# Linux sudo apt-get install npm
-
Add the following snippets to your bash configuration files (
.bash_profile
on OS X,.bashrc
on Linux).# OS X export NVM_DIR=~/.nvm source $(brew --prefix nvm)/nvm.sh
# Linux export NVM_DIR="/home/your_username/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
-
Use NVM to install the latest stable version of Node
nvm install stable
-
Finally, use NPM to install the Node modules mentioned earlier and make them available across all of our projects.
npm install -g jshint grunt-cli
-
Download the latest Sublime Text build from http://www.sublimetext.com/3.
-
Double-click the .dmg file to open it, and drag the icon into your 'Applications' folder.
-
Next, enter the following into your terminal - it will create a 'symlink', a shortcut that we can use to open Sublime from the command line. Do not skip this step!
ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl
-
Add the PPA (personal package archive) for SublimeText 3 to
apt
and update your package directory.sudo add-apt-repository ppa:webupd8team/sublime-text-3
sudo apt-get update
-
Use
apt
to install SublimeText 3sudo apt-get install sublime-text-installer
-
Create a symlink shortcut for your terminal.
sudo ln -s /**wherever the binary for Sublime is** /bin/subl
Once Sublime Text is installed, there are a couple of modifications that you'll need to make before you're all set.
Go to your Preferences in Sublime Text, open "Settings - User", and replace the entire contents with the following:
{
"autocomplete_on_tab": false,
"ensure_newline_at_eof_on_save": true,
"ignored_packages":
[
"Vintage"
],
"scroll_past_end": true,
"tab_size": 2,
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true,
"word_wrap": true
}
Note: If you've already made other customizations to this preferences file, you'll need to manually add them back later.
Don't forget to save the file before closing it!
One of Sublime Text's best features is its extensibility - there are a wide variety of add-ons and extras. To keep all those add-ons organized and up-to-date, we'll need a package manager.
Hit ctrl + `
to enter the Sublime Text console; there, paste in the following code.
import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); open(os.path.join(ipp, pf), 'wb').write(urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ','%20')).read())
- Hit
command + shift + p
to enter the Command Pallette; and enterinstall
into the search bar to open the package manager. - Install each of the following plugins:
- All Autocomplete
- AngularJS
- BeautifyRuby
- Better CoffeeScript
- Dotfiles Syntax Highlighting
- GitGutter
- Haml
- Handlebars
- HTML5
- jQuery
- Sass
- SideBarEnhancements
If you haven't done so already, go to GitHub and create and account; be sure to write down your username and password somewhere, since we'll be using these credentials later.
For OS X, enter the command brew install git
. For Linux, enter sudo apt-get install git
. Easy as pie!
Now let's take care of some settings.
-
Show the current Git branch in the terminal prompt
Run the command
subl ~/.bashrc
. Paste the following code into the bottom of the file.# Git function parse_git_branch { ref=$(git symbolic-ref HEAD 2> /dev/null) || return echo "("${ref#refs/heads/}")" } export PS1="\w \$(parse_git_branch)\$ "
-
Tweak Git's EDITOR variable so that commit message pop-ups open in Sublime.
echo "export EDITOR='subl -w'" >> ~/.bashrc
-
Colorize git in the command line
git config --global color.ui true`
-
Set up a global 'excludesfile', listing all the files that we might want git to ignore.
git config --global core.excludesfile ~/.gitignore echo ".DS_Store" >> ~/.gitignore
-
Set a default user
git config --global user.name "yourUsername" git config --global user.email "[email protected]"
In order to push commits to GitHub from the command line, we need Git and GitHub to have a matching set of SSH keys.
- Generate a new key by running
ssh-keygen -t rsa -C "[email protected]"
(feel free to put in a password or select a non-default location for your keys, but it's not necessary to do so; to move ahead, just keep hittingenter
). - Add this new key to your system by running
ssh-add ~/.ssh/id_rsa
- Copy the new key to your clipboard using either
pbcopy < ~/.ssh/id_rsa.pub
(OS X) orxclip -selection clipboard < ~/.ssh/id_rsa.pub
(Linux); then, log into GitHub.com, go to https://github.com/settings/ssh, and paste in your SSH key. To test it out, type the following into the command line:
ssh -T [email protected]
If you get a prompt along the lines of
The authenticity of host 'github.com (xxx.xxx.xxx.xxx)'... can't be established.
RSA key fingerprint is XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX.
Are you sure you want to continue connecting (yes/no)?
just type 'yes'. If everything's working, you should get a response like the following:
Hi yourUsername! You've succesfully authenticated, but GitHub does not provide shell access.
Rbenv is a tool that we can use to manage multiple versions of Ruby and determine which version we use for a particular project.
- Install Rbenv
#####OS X
Run `brew install rbenv`.
#####Linux
Copy and paste this entire line into your terminal and run it.
`curl https://raw.githubusercontent.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash`
- Tell Rbenv to use homebrew's directories instead of rbenv's
#####OS X Open ~/.bashrc and paste in the following code BEFORE the stuff you pasted in about Git.
```bash
# Rbenv
export RBENV_ROOT=/usr/local/var/rbenv
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
```
#####Linux
Open ~/.bashrc and paste in the following code BEFORE the stuff you pasted in about Git.
```bash
# Rbenv
export RBENV_ROOT="${HOME}/.rbenv"
if [ -d "${RBENV_ROOT}" ]; then
export PATH="${RBENV_ROOT}/bin:${PATH}"
eval "$(rbenv init -)"
fi
```
Once you've done this, run source ~/.bashrc
to reload the terminal's settings.
-
(OS X only) Install a tool to re-hash gems after each installation (Linux users, unfortunately must do this manually).
brew install rbenv-gem-rehash
Then download a package with a number of common gems.
`brew install rbenv-default-gems`
-
(Linux only) Rbenv on Linux depends on another library called
libffi-dev
. Download and install it with the following command.sudo apt-get install libffi-dev
-
Install
ruby-build
, a plugin for rbenv.
#####OS X
`brew install ruby-build`
#####Linux
`git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build`
`rbenv install ruby-build`
- Install version 2.2.0 of Ruby and make it the system-wide default using the command
rbenv install 2.2.0 && rbenv global 2.2.0
You can see what versions of Ruby rbenv has downloaded by running rbenv versions
; to see which version you are currently using, type either rbenv version
or ruby -v
.
Now that you have Ruby installed, you can begin to install gems on your own. However, gems usually come with a lot of unnecessary documentation - let's tell Ruby to skip those by running the following command:
echo 'gem: --no-rdoc --no-ri' >> ~/.gemrc
Next, we'll go ahead and install Rails.
gem install rails
Here are a couple of other gems we should also install.
gem install bundler
#Postgres
Next, we'll download Postgres, the database program we'll be using for most of the course.
- First, download and install Postgres.
#####OS X
Download and install the Postgress App : http://postgresapp.com/
#####Linux
Run sudo apt-get install postgresql libpq-dev
to install Postgres and its dependencies.
- Once you've installed Postgres, install the postgres gem from the command line so that Ruby can access it.
#####OS X
gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config
#####Linux
gem install pg
Linux folks must also specify a default database user, using the following command:
sudo -u postgres createuser *<ubuntu_username>* -s
See https://help.ubuntu.com/community/PostgreSQL if you run into any issues with the installation.
- It's terminal shortcut time! Let's configure a
psql
shortcut so that we can run Postgres from the command line.
#####OS X
Create a new terminal shortcut, just like we did with Sublime Text.
ln -s /Applications/Postgres.app/Contents/Versions/9.4/bin/psql /usr/local/bin/psql
#####Linux
Linux already has a shortcut set up for us; just add the existing shortcut to the environmental PATH variable.
echo "export PATH=/usr/local/psql/bin:$PATH" >> ~/.bashrc
#CONGRATULATIONS! YOU'RE READY TO ROLL!