Bitrise, the Continuous Integration and Delivery (CI/CD) Platform, has recently deprecated the use of
rbenv. This means that
rbenv will no longer receive updates and support. But don't worry, there's a new tool in town -
asdf! This blog post will guide you through the process of switching from
If you need more reasons to change tool,
asdf has many features:
- Multiple Language Support:
asdfis not limited to Ruby. It supports a wide range of programming languages and tools including Node.js, Python, Elixir, Erlang, and many more. This means you can manage versions of all these languages using a single tool.
- Plugin System:
asdfuses a plugin system, which means you can extend its functionality to support more languages or tools. There are already many community-contributed plugins available.
- Per-project Version Settings: Like
asdfallows you to set the version of a language/tool on a per-project basis. This is done by placing a
.tool-versionsfile in your project directory.
- Ease of Use:
asdfprovides a simple, consistent interface for managing versions of different languages/tools. Once you learn how to use
asdf, you can apply the same knowledge to manage versions of all supported languages/tools.
asdfis compatible with both Unix and Unix-like systems including macOS, and it also works well with the Windows Subsystem for Linux (WSL).
- Global and Local Version Management:
asdfallows you to set global versions for your languages/tools, but also override them on a per-project basis. This gives you a lot of flexibility in managing versions.
Uninstalling Ruby Versions and rbenv on Mac using Brew
rbenv, it's important to uninstall any existing versions of Ruby that were installed through
rbenv. You can do this by running the following script in your terminal:
#!/bin/bash versions=$(rbenv versions --skip-aliases --bare) for version in $versions; do echo "Removing Ruby version $version" rbenv uninstall $version done
The script gets all installed versions, iterates over them, and uninstalls. Clean and easy!
Once you've uninstalled all versions of Ruby, you can uninstall
rbenv. If you installed
rbenv using Homebrew, you can uninstall it by running the following command in your terminal:
brew uninstall rbenv
This command will remove
rbenv and its dependencies from your system.
Cleaning Up zshrc
rbenv, it's a good idea to clean up your shell configuration file (
~/.zshrc for Zsh users) by removing any
rbenv related lines. This step is important to prevent any potential conflicts with
~/.zshrc file in a text editor and look for lines that mention
rbenv. These lines might look something like this:
export PATH="$HOME/.rbenv/bin:$PATH" eval "$(rbenv init -)"
Remove these lines, then save and close the file. Afterward, source your
~/.zshrc file to apply the changes by running:
Installing and Setting Up asdf
Now, let's install
asdf. You can do this by running the following commands in your terminal:
brew install asdf
asdf, you need to add it to your shell so that it can be used from the command line. Add the following lines to your
. "/usr/local/opt/asdf/libexec/asdf.sh" . "/usr/local/opt/asdf/etc/bash_completion.d/asdf.bash"
Then, source your
~/.zshrc file to apply the changes:
Installing Ruby with asdf
asdf installed and set up, you can now install Ruby. To install Ruby 3.1.4, run the following command:
asdf install ruby 3.1.4
Using Local and Global Environments
asdf allows you to manage both local and global environments.
To set a global version for a tool, use the
asdf global command followed by the tool name and the version number. For example, to set Ruby 3.1.4 as the global version, you would run:
asdf global ruby 3.1.4
To set a local version for a tool, use the
asdf local command followed by the tool name and the version number. This will create a
.tool-versions file in your current directory, which
asdf will use to determine the version to use. For example, to set Ruby 3.1.4 as the local version, you would run:
asdf local ruby 3.1.4
And that's it! You've successfully switched from
asdf on Bitrise. Happy coding!