Skip to content

Get started with Bolt locally

colbytcook edited this page Jan 12, 2023 · 32 revisions

Install

This is a walk through of the required steps to get Bolt installed and running locally.

Set Up Initial Environment

  1. Open up Terminal and type cd and press enter to reset directory
  2. Install Oh My Zsh (⚠️ this is needed for step 10)
    sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
    
  3. Install Brew
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
  4. Install Yarn
    brew install yarn
    
    • In case of "/usr/local/Cellar is not writable." error, run this line
      sudo shown -R $(whoami) /usr/local/Cellar
      
  5. Install XCode (the app can be found in the Mac App Store), and open it after, make sure you address any permission prompts
  6. Install Composer
    brew install composer
    
  7. Install Git
    brew install git
    
  8. Install NVM (see latest info if the following doesn't work)
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
    
  9. Restart the Terminal with the command (⚠️ this only applies if you did step 2 and using Z Shell, otherwise reference the link in the last step)
    source ~/.zshrc
    
  10. Install Node
    nvm install 14.18.1
    
  11. Set 14.18.1 as default node version
    nvm alias default 14.18.1
    

Set Up the Bolt Repository

  1. In Finder, decide where you want to store code and create a folder
  2. Restart Terminal and cd into the folder to clone the Bolt repository, for example
    cd Users/yourname/sites
    
  3. Clone the Bolt repository
    git clone https://github.com/boltdesignsystem/bolt
    
  4. Alternatively, use the Github Desktop app to do the last 2 steps if you are not familiar with command lines in Terminal
  5. Move into the Bolt repo folder
    cd Users/yourname/sites/bolt
    
  6. Set up Bolt
    yarn setup
    
    • If icon SVGs or Pattern Lab UI files have changed since last time you ran Bolt, you will have to build as well
      yarn build
      
  7. Run Bolt
    yarn start
    
    • This will open a local instance of Bolt in your browser (eg. localhost:4000)
  8. If needed, create a new branch before running yarn setup

😵‍💫 Troubleshooting 😵‍💫

If yarn setup fails the first time you run it, check to see if you have PHP 7.

  1. Open up Terminal and type cd and press enter to reset directory
  2. Check PHP version
    php -v
    
  3. If it is not PHP 7, install PHP 7.4
    brew install php@7.4
    
  • Most likely you will have the following error due to PHP 7.4 being not supported
    Error: php@7.4 has been disabled because it is a versioned formula! 
    
    If you do get this error run the following commands
    brew tap shivammathur/php
    brew install shivammathur/php/php@7.4
    brew link php@7.4 
    
  1. Open up Finder and go to your user folder (eg. Macintosh HD/Users/yourname)
  2. Press cmd + shft + . to show hidden files
  3. Open the .zshrc file with a text editor (VS Code, Sublime Text, etc.)
  4. Add the following line to the bottom of the .zshrc file
    export PATH="/usr/local/opt/php@7.4/bin:$PATH"
    
  5. Refresh the source
    source ~/.zshrc
    
  6. Move into the Bolt repo folder again
    cd Users/yourname/sites/bolt
    
  7. Set up Bolt again
    yarn setup
    
Clone this wiki locally