Skip to content

Instantly share code, notes, and snippets.

@ambsvan
Forked from monicao/notes.md
Created July 1, 2014 20:13
Show Gist options
  • Save ambsvan/1903b631b3826439d44c to your computer and use it in GitHub Desktop.
Save ambsvan/1903b631b3826439d44c to your computer and use it in GitHub Desktop.

Revisions

  1. @monicao monicao revised this gist Jul 1, 2014. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions notes.md
    Original file line number Diff line number Diff line change
    @@ -93,6 +93,7 @@ Follow these instructions: http://stackoverflow.com/questions/23260748/manual-in
    2. Click on Xcode > Open Developer Tools > More Developers Tools
    This will take you to the Downloads for Apple Developers web site. Use your AppStore Id to login.
    3. Download Command Line Tools for your Mac OS X version. (Probably Mavericks April / March 2014).
    ![http://monicao.s3.amazonaws.com/gist_images/Screen%20Shot%202014-07-01%20at%2012.42.06%20PM.png](http://monicao.s3.amazonaws.com/gist_images/Screen%20Shot%202014-07-01%20at%2012.42.06%20PM.png)

    ### See if it worked

  2. @monicao monicao revised this gist Jul 1, 2014. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions notes.md
    Original file line number Diff line number Diff line change
    @@ -172,6 +172,9 @@ TCP/IP connections on port 5432?

    ![http://monicao.s3.amazonaws.com/gist_images/Screen%20Shot%202014-07-01%20at%2012.37.08%20PM.png](http://monicao.s3.amazonaws.com/gist_images/Screen%20Shot%202014-07-01%20at%2012.37.08%20PM.png)

    You probably have XCode 5.1.1 or higher and tried to install the command line tools via command line.
    See Install the command line developer tools section above.

    ## Help Improve this

    I wrote this down from memory. If any of the steps here don't work, please fork this gist, fix the issue and share with the class.
  3. @monicao monicao revised this gist Jul 1, 2014. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions notes.md
    Original file line number Diff line number Diff line change
    @@ -168,6 +168,10 @@ TCP/IP connections on port 5432?
    /Users/SYS/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/activerecord-4.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:881:in `initialize'
    ```

    ### XCode: Can't install software because it's not currently available on your computer

    ![http://monicao.s3.amazonaws.com/gist_images/Screen%20Shot%202014-07-01%20at%2012.37.08%20PM.png](http://monicao.s3.amazonaws.com/gist_images/Screen%20Shot%202014-07-01%20at%2012.37.08%20PM.png)

    ## Help Improve this

    I wrote this down from memory. If any of the steps here don't work, please fork this gist, fix the issue and share with the class.
  4. @monicao monicao revised this gist Jul 1, 2014. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions notes.md
    Original file line number Diff line number Diff line change
    @@ -150,6 +150,8 @@ bin/rake db:create

    ## Troubleshooting

    ### Could not connect to server: Connection refused

    If you see this error, make sure Postgres.app is started. You should see an elephant icon in your mac's top bar.

    ```
  5. @monicao monicao revised this gist Jul 1, 2014. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions notes.md
    Original file line number Diff line number Diff line change
    @@ -94,6 +94,13 @@ Follow these instructions: http://stackoverflow.com/questions/23260748/manual-in
    This will take you to the Downloads for Apple Developers web site. Use your AppStore Id to login.
    3. Download Command Line Tools for your Mac OS X version. (Probably Mavericks April / March 2014).

    ### See if it worked

    ```
    gem install nokogiri
    ```


    ## Install the gems for a Rails project

    ```
  6. @monicao monicao revised this gist Jul 1, 2014. 1 changed file with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions notes.md
    Original file line number Diff line number Diff line change
    @@ -77,12 +77,22 @@ gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/

    ## Install the command line developer tools

    ### If you have XCode < 5.1.1

    The nokogiri gem needs these. See here for details: http://jasdeep.ca/2013/10/installing-nokogiri-fails-os-x-mavericks/

    ```
    xcode-select --install
    ```

    ### If you have XCode > 5.1.1

    Follow these instructions: http://stackoverflow.com/questions/23260748/manual-install-of-xcode-command-line-tools-not-working

    1. Open XCode
    2. Click on Xcode > Open Developer Tools > More Developers Tools
    This will take you to the Downloads for Apple Developers web site. Use your AppStore Id to login.
    3. Download Command Line Tools for your Mac OS X version. (Probably Mavericks April / March 2014).

    ## Install the gems for a Rails project

  7. @monicao monicao revised this gist Jul 1, 2014. 1 changed file with 0 additions and 6 deletions.
    6 changes: 0 additions & 6 deletions notes.md
    Original file line number Diff line number Diff line change
    @@ -102,17 +102,13 @@ development:
    adapter: postgresql
    database: your_project_development
    host: localhost
    username: your_mac_user_name # use whoami in the terminal to see what the user name is
    password: # leave the password blank
    encoding: unicode
    pool: 5
    test:
    adapter: postgresql
    database: your_project_test
    host: localhost
    username: your_mac_user_name # use whoami in the terminal to see what the user name is
    password: # leave the password blank
    encoding: unicode
    pool: 5
    ```
    @@ -125,8 +121,6 @@ development:
    adapter: postgresql
    database: hooligans_development
    host: localhost
    username: monica
    password:
    encoding: unicode
    pool: 5
    ```
  8. @monicao monicao revised this gist Jun 20, 2014. 1 changed file with 17 additions and 0 deletions.
    17 changes: 17 additions & 0 deletions notes.md
    Original file line number Diff line number Diff line change
    @@ -137,6 +137,23 @@ To check if this works, see if you can create the database.
    bin/rake db:create
    ```

    ## Troubleshooting

    If you see this error, make sure Postgres.app is started. You should see an elephant icon in your mac's top bar.

    ```
    SYS:laser_shark SYS$ bin/rake db:create
    could not connect to server: Connection refused
    Is the server running on host "localhost" (127.0.0.1) and accepting
    TCP/IP connections on port 5432?
    could not connect to server: Connection refused
    Is the server running on host "localhost" (::1) and accepting
    TCP/IP connections on port 5432?
    could not connect to server: Connection refused
    Is the server running on host "localhost" (fe80::1) and accepting
    TCP/IP connections on port 5432?
    /Users/SYS/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/activerecord-4.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:881:in `initialize'
    ```

    ## Help Improve this

  9. @monicao monicao revised this gist Jun 20, 2014. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions notes.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    # Setting up the Ruby dev environment on Mavericks

    ## Why would I want to do that?

    - You want to run guard
  10. @monicao monicao revised this gist Jun 20, 2014. 1 changed file with 32 additions and 7 deletions.
    39 changes: 32 additions & 7 deletions notes.md
    Original file line number Diff line number Diff line change
    @@ -65,38 +65,57 @@ rails -v

    http://postgresapp.com/

    ## Install the `pg` gem

    ## Install the gems for a Rails project
    Here's how to install the pg gem with Postgres.app. http://stackoverflow.com/questions/20224483/cannot-install-pg-gem-in-mavericks-with-postgres-app

    ```
    cd /Users/monica/lighthouse/laser_shark
    bundle install
    gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
    ```

    When you are running `bundle install` inside a Rails project that uses the `pg` gem you have to run set the ARCHFLAGS first.
    ## Install the command line developer tools

    The nokogiri gem needs these. See here for details: http://jasdeep.ca/2013/10/installing-nokogiri-fails-os-x-mavericks/

    ```
    sudo ARCHFLAGS="-arch x86_64" bundle install
    xcode-select --install
    ```


    ## Install the gems for a Rails project

    ```
    cd /Users/monica/lighthouse/laser_shark
    bundle install
    ```

    Follow the other setup instructions for that rails app. For `laser_shark`, you will have to edit your `/etc/hosts`, for example.

    ## Change `database.yml`

    In config/database.yml, use the following settings:
    In config/database.yml, make sure you have the following settings. Make sure you have the `host`, the password is blank, and the username is set to your computer's username. If you are not sure what your computer's username is, try running `whoami` in the terminal.

    ```
    development:
    adapter: postgresql
    database: your_project_development
    host: localhost
    username: your_mac_user_name
    username: your_mac_user_name # use whoami in the terminal to see what the user name is
    password: # leave the password blank
    encoding: unicode
    pool: 5
    test:
    adapter: postgresql
    database: your_project_test
    host: localhost
    username: your_mac_user_name # use whoami in the terminal to see what the user name is
    password: # leave the password blank
    encoding: unicode
    pool: 5
    ```


    Here's my database.yml for a rails project called hooligans

    ```
    @@ -110,6 +129,12 @@ development:
    pool: 5
    ```

    To check if this works, see if you can create the database.

    ```
    bin/rake db:create
    ```


    ## Help Improve this

  11. @monicao monicao revised this gist Jun 19, 2014. 1 changed file with 13 additions and 5 deletions.
    18 changes: 13 additions & 5 deletions notes.md
    Original file line number Diff line number Diff line change
    @@ -66,18 +66,21 @@ rails -v
    http://postgresapp.com/


    ## Install the pg gem
    ## Install the gems for a Rails project

    Configuring Ruby for Postgres.app

    To install the pg gem, make sure you have set up your `$PATH` correctly.
    ```
    cd /Users/monica/lighthouse/laser_shark
    bundle install
    ```

    When you are running `bundle install` inside a Rails project that uses the `pg` gem you have to run set the ARCHFLAGS first.

    ```
    sudo ARCHFLAGS="-arch x86_64" bundle install
    ```

    Follow the other setup instructions for that rails app. For `laser_shark`, you will have to edit your `/etc/hosts`, for example.

    ## Change `database.yml`

    In config/database.yml, use the following settings:
    @@ -105,4 +108,9 @@ development:
    password:
    encoding: unicode
    pool: 5
    ```
    ```


    ## Help Improve this

    I wrote this down from memory. If any of the steps here don't work, please fork this gist, fix the issue and share with the class.
  12. @monicao monicao revised this gist Jun 19, 2014. 1 changed file with 76 additions and 5 deletions.
    81 changes: 76 additions & 5 deletions notes.md
    Original file line number Diff line number Diff line change
    @@ -17,7 +17,7 @@ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

    Now that we have Homebrew installed, we can use it to install Ruby.

    We're going to use rbenv to install and manage our Ruby versions.
    We're going to use rbenv to install and manage our Ruby versions. rbenv makes it really easy to have several versions of ruby on your laptop and switch between them.

    To do this, run the following commands in your Terminal:

    @@ -28,10 +28,81 @@ brew install rbenv ruby-build
    echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
    source ~/.bash_profile
    # Install Ruby 2.1.2 and set it as the default version
    rbenv install 2.1.2
    rbenv global 2.1.2
    # Install Ruby 2.1.1 and set it as the default version
    rbenv install 2.1.1
    rbenv global 2.1.1
    ruby -v
    # ruby 2.1.2
    # ruby 2.1.1
    ```

    Check out this article for a list of rbenv commands: http://cbednarski.com/articles/installing-ruby/

    ## Install rails

    Install rails on your system so you can create new rails projects.

    ```
    gem install rails
    ```

    Rails is now installed, but in order for us to use the rails executable, we need to tell rbenv to see it:

    ```
    rbenv rehash
    ```

    And now we can verify Rails is installed:

    ```
    rails -v
    # Rails 4.1.1
    ```

    ## Install the Postgres.app

    "The easiest way to run Postgres on your Mac"

    http://postgresapp.com/


    ## Install the pg gem

    Configuring Ruby for Postgres.app

    To install the pg gem, make sure you have set up your `$PATH` correctly.

    When you are running `bundle install` inside a Rails project that uses the `pg` gem you have to run set the ARCHFLAGS first.

    ```
    sudo ARCHFLAGS="-arch x86_64" bundle install
    ```

    ## Change `database.yml`

    In config/database.yml, use the following settings:

    ```
    development:
    adapter: postgresql
    database: your_project_development
    host: localhost
    username: your_mac_user_name
    password: # leave the password blank
    encoding: unicode
    pool: 5
    ```

    Here's my database.yml for a rails project called hooligans

    ```
    development:
    adapter: postgresql
    database: hooligans_development
    host: localhost
    username: monica
    password:
    encoding: unicode
    pool: 5
    ```
  13. @monicao monicao revised this gist Jun 19, 2014. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions notes.md
    Original file line number Diff line number Diff line change
    @@ -13,6 +13,8 @@ Open up the Mac Terminal and run this command to install brew on your mac:
    ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
    ```

    ## Install ruby through `rbenv`

    Now that we have Homebrew installed, we can use it to install Ruby.

    We're going to use rbenv to install and manage our Ruby versions.
  14. @monicao monicao created this gist Jun 19, 2014.
    35 changes: 35 additions & 0 deletions notes.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    ## Why would I want to do that?

    - You want to run guard
    - You want use Sublime plugins (like RSpec or Guard plugins)

    ## Installing `brew`

    [Brew](http://brew.sh/) aka Homebrew is a package management system for Mac OSX.

    Open up the Mac Terminal and run this command to install brew on your mac:

    ```
    ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
    ```

    Now that we have Homebrew installed, we can use it to install Ruby.

    We're going to use rbenv to install and manage our Ruby versions.

    To do this, run the following commands in your Terminal:

    ```
    brew install rbenv ruby-build
    # Add rbenv to bash so that it loads every time you open a terminal
    echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
    source ~/.bash_profile
    # Install Ruby 2.1.2 and set it as the default version
    rbenv install 2.1.2
    rbenv global 2.1.2
    ruby -v
    # ruby 2.1.2
    ```