Skip to content

Instantly share code, notes, and snippets.

@bill-mfv
Last active July 14, 2022 06:29
Show Gist options
  • Save bill-mfv/2b6845a44df5c9a70ecb8c92df603610 to your computer and use it in GitHub Desktop.
Save bill-mfv/2b6845a44df5c9a70ecb8c92df603610 to your computer and use it in GitHub Desktop.
Install RoR env

HomeBrew is a package manager for OSX. Brew install missing stuff so easy…

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

Change permission for zsh

  • Change the ownership of these directories to your user:
    sudo chown -R $(whoami) /usr/local/share/zsh /usr/local/share/zsh/site-functions
  • And make sure that your user has write permission:
    chmod u+w /usr/local/share/zsh /usr/local/share/zsh/site-functions

RVM: is a command-line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems.

  • Install GPG keys:
    brew install gnupg
    gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

    • or if it fails:
     command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
     command curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -
    

In case of further problems with validation please refer to https://rvm.io/rvm/security

  • Install RVM:
    \curl -sSL https://get.rvm.io | bash -s stable
  • Install Ruby:
    rvm install 2.6.3 (2.6.3 is version of Ruby, you can change it to whater version you want)

Because each project will have a different gem list, so you should use a gemset for each project. In local you should create a file .rvmrc in project folder.
Example: if project is using ruby 2.6.3, we will have
rvm use 2.6.3@gemset_name --create

Each time we cd into the project folder, the rvm will use right gemset for this project.

MySQL

Version 5.7

  • Find older mysql versions
    brew search mysql

  • Install older mysql version . brew install mysql@5.7

  • Start agent for older version of mysql (including on login) . ln -sfv /usr/local/opt/mysql@5.7/*.plist ~/Library/LaunchAgents launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql@5.7.plist

  • Unlink current mysql version . brew unlink mysql

  • Check older mysql version . ls /usr/local/Cellar/mysql@5.7
    Example output: 5.7.25

  • Link the older version (above output) . brew switch mysql@5.7 5.7.25

  • If you have trouble with installing the mysql gem when bundle install, you can run:
    gem install mysql2 -v '0.5.2' --source 'https://rubygems.org/' -- --with-mysql-config=/usr/local/opt/mysql@5.7/bin/mysql_config

  • Start & Stop mysql service:
    /usr/local/opt/mysql@5.7/bin/mysql.server start /usr/local/opt/mysql@5.7/bin/mysql.server stop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment