Bridgetown on macOS
Install Ruby #
With rbenv #
People often use rbenv to manage multiple Ruby versions, which comes in handy when you need to run a specific Ruby version on a project.
# Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install rbenv and ruby-build
brew install rbenv
# Set up rbenv integration with your shell
rbenv init
Restart your terminal for changes to take effect.
Now you can install a new Ruby version. At the time of this writing, Ruby 3.0.2 is the latest stable version. (Note: the installation may take a few minutes to complete.)
rbenv install 3.0.2
rbenv global 3.0.2
ruby -v
> ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [arm64-darwin20]
(If for some reason bundler
isn’t installed automatically, just run gem install bundler -N
)
And that’s it! Check out rbenv command references to learn how to use different versions of Ruby in your projects.
Now jump down to the Install Node section.
With Homebrew #
You may install Ruby directly through Homebrew.
# Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install ruby
Add the brew ruby path to your shell config:
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.zprofile
Then relaunch your terminal and check your updated Ruby setup:
which ruby
# /usr/local/opt/ruby/bin/ruby
ruby -v
Yay, we are now running current stable Ruby!
To set up Bundler for managing Rubygem dependencies as well as Ruby executable paths, run:
gem install --user-install bundler
Then append your path file with the following, replacing the X.X
with the first two digits of your Ruby version.
echo 'export PATH="$HOME/.gem/ruby/X.X.0/bin:$PATH"' >> ~/.zprofile
Then relaunch your terminal and check that your gem paths point to your home directory by running:
gem env
And check that SHELL PATH:
includes to a path to ~/.gem/ruby/X.X.0/bin
Every time you update Ruby to a version with a different first two digits, you will need to update your path to match.
You will also need to add --user-install
to any gem install
statement you run.
Install Node #
Node is a JavaScript runtime that can execute on a server or development machine. NPM is a package manager for JavaScript packages. You’ll need Node in order to install and use esbuild, the frontend asset compiler that runs alongside Bridgetown.
The easiest way to install Node is via Homebrew (which should already be installed after following the instructions above).
brew update
brew install node
Then verify your installed version:
node -v
Install Bridgetown #
Now all that is left is to install Bridgetown!
gem install bridgetown -N -v 2.0.0.beta2
Create a new Bridgetown site at ./mysite
, as well as run bundle install
and
npm install
automatically:
bridgetown new mysite
cd mysite
Now you should be able to build the site and run a live-reload server:
bin/bridgetown start
Try opening the site up in http://localhost:4000. See something? Awesome, you’re ready to roll! If not, try revisiting your installation and setup steps, and if all else fails, reach out to the Bridgetown community for support.