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.1 is the latest stable version. (Note: the installation may take a few minutes to complete.)
rbenv install 3.0.1
rbenv global 3.0.1
ruby -v
> ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [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 & Yarn 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
Install Node & Yarn
Node is a JavaScript runtime that can execute on a server or development machine. Yarn is a package manager for Node packages. You’ll need Node and Yarn in order to install and use Webpack, the frontend asset compiler that runs alongside Bridgetown. Yarn is also used along with Concurrently and Browsersync to spin up a live-reload development server.
The easiest way to install Node and Yarn is via Homebrew (which should already be installed after following the instructions above).
brew update
brew install node
brew install yarn
Then verify your installed versions:
node -v
yarn -v
Install Bridgetown
Now all that is left is to install Bridgetown!
gem install bridgetown -N
Create a new Bridgetown site at ./mysite
, as well as run bundle install
and
yarn install
automatically:
bridgetown new mysite
cd mysite
Now you should be able to build the site and run a live-reload server:
$ yarn 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.