Skip to content

Instantly share code, notes, and snippets.

@jpbalarini
Last active January 26, 2020 12:37
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpbalarini/9a05c38b0456eaece883 to your computer and use it in GitHub Desktop.
Save jpbalarini/9a05c38b0456eaece883 to your computer and use it in GitHub Desktop.
Mac OS Sierra Rails development

How to configure your Mac OS for Ruby on Rails development

  1. Install Sublime Text from here

  2. Install Xcode from the AppStore

  3. Open Xcode and accept the licence

  4. Install command line tools. From the terminal run:

    xcode-select --install
    
  5. Install homebrew

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

    brew doctor
    
  7. Update homebrew

    brew update
    
  8. Install git

    brew install git
    
  9. Install RVM

    curl -L https://get.rvm.io | bash -s stable --autolibs=enabled
    source ~/.rvm/scripts/rvm
    
  10. Install Ruby

    rvm install 2.4.4
    
  11. Set default Ruby version

    rvm use 2.4.4 --default
    
  12. Install rails and bundler

    gem install rails bundler --no-ri --no-rdoc
    
  13. Install wget

    brew install wget
    
  14. Configure git

    ssh-keygen -t rsa -C "YOUR GENERATED EMAIL"
    git config --global user.email "YOUR EMAIL"
    git config --global user.name "YOUR NAME"
    git config --global core.editor "subl -w"
    git config --global color.ui true
    
  15. Configure Sublime
    15.1. Create subl command

    sudo mkdir -p /usr/local/bin/ && sudo ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl
    

    15.2. Install package manager as shown here
    15.3. Configure user settings (Sublime Text -> Preferences -> Settings)

    {
      "ensure_newline_at_eof_on_save": true,
      "font_size": 12,
      "show_encoding": true,
      "tab_size": 2,
      "translate_tabs_to_spaces": true,
      "trim_trailing_white_space_on_save": true
    }
    
  16. Install mysql

    brew install mysql
    brew services start mysql
    
  17. Install Postgres app from here

  18. Configure PATHs:
    Open bash_profile:

    nano ~/.bash_profile 
    

    Paste the following:

    export PATH=$PATH:/usr/local/bin
    export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin
    

    Save those changes and exit.

    Finally, apply those changes:

    source ~/.bash_profile
    
  19. Open psql (type psql in your terminal) and run:

    CREATE USER postgres SUPERUSER;
    
  20. General MAC OS config
    Show Path bar in Finder

    defaults write com.apple.finder ShowPathbar -bool true
    

    Show Status bar in Finder

    defaults write com.apple.finder ShowStatusBar -bool true
    
  21. Other
    21.1. Install libxslt

    brew install libxslt
    

    21.2. Configure no doc

    subl ~/.gemrc
    

    Paste this:

    install: --no-rdoc --no-ri
    update:  --no-rdoc --no-ri
    

    21.3. Add aliases:

    subl ~/.gitconfig
    

    Add the following

    [alias]
      ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
      ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
      tree = log --oneline --decorate --all --graph
    
  22. JUST IF ERRORS APPEAR WHILE BUNDLING:

    gem uninstall libv8
    brew install v8
    gem install therubyracer
    gem install libv8 -v '3.16.14.3' -- --with-system-v8
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment