Using rbenv
On the working directory where the Amplify application is installed (usually /amp1/
):
- Checkout the Amplify branch in which we are going to work
rbenv install 2.7.3
(change the version accordingly)gem install bundler
- MAYBE (try to omit this):
gem install rails
BUNDLE_GITLAB__COM=bundler:UoS1DTrBrPPDAyfCS3p5 bundle install
(this will install all the necessary packages for this Amplify version)pm2 start
- Migrate DBs (example:
bin/rails db:migrate RAILS_ENV=development
)
List available Ruby versions:
rbenv install -l
Set local Ruby version:
Sets a local per-project Ruby version by writing the version name to an .rbenv-version
file in the current directory. This version overrides the global, and can be overridden itself by setting the RBENV_VERSION
environment variable or with the rbenv shell
command.
$ rbenv local rbx-1.2.4
When run without a version number, rbenv local
reports the currently configured local version. You can also unset the local version:
$ rbenv local --unset
More information: https://javierjulio.com/rbenv/#section_3.2
rbenv vs. RVM
Both rbenv and RVM are Ruby version management tool. RVM is more resourceful but rbenv is lightweight which makes it a strong contender for RVM. RVM is used to manage and install different versions of Ruby and gemsets on system where Rbenv is a lightweight Ruby version management tool. Compared to RVM, rbenv does not manage gemsets nor install different Ruby versions. It only manages different ruby versions. These tasks are now better off handled by other tools such as Bundler which is a much better tool for handling dependencies, and many gems these days are already using it. Starting a project is easy as typing bundle install
. This makes rbenv more developer friendly.
Source: https://namangupta01.medium.com/replacing-rvm-with-rbenv-in-os-x-9dea622bd639
Using RVM
To see Ruby versions:
rvm list
To install a new version of Ruby:
rvm list known # List all Ruby versions
rvm install ruby-2.6.3 # To install a particular version of Ruby