Skip to content

Scripts to prepare a Mac for Ruby / Python / Ansible / Chef / Intel Edison IoT development

License

Notifications You must be signed in to change notification settings

LyraPhase/sprout-wrap

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

sprout-wrap

ci pre-commit pre-commit

NOTE: This is a Fork 🍴⚠️ πŸ”±

This project uses soloist and librarian-chef to run a custom set of the recipes in sprout-wrap's cookbooks.

Additionally, it adds the lyraphase_workstation cookbook for installing a Digital Audio Workstation (DAW), and miscellaneous audio and development tools.

Sponsor

Keeping this bootstrap provisioning project working on each macOS update sure is a lot of work! If you find this project useful and appreciate my work, would you be willing to click one of the buttons below to Sponsor this project and help me continue?

Method Button
GitHub πŸ’– Sponsor
Liberapay Donate using Liberapay
PayPal Donate with PayPal

Every little bit is appreciated! Thank you! πŸ™

Prerequisites

This guide assumes that you have an Apple machine running a recent version of macOS.

The Semi-Manual way section assumes that you know how to use RVM to install Ruby and Bundler to install Ruby Gems, but gives some commands to assist you in installing the supported versions.

Installation on macOS

The Easy Way πŸš€

1. Run bootstrap script

Open a terminal and run:

\curl -Ls https://git.io/Jy0EQ | bash

Alternatively, run:

git clone https://github.com/LyraPhase/sprout-wrap.git
cd sprout-wrap
make bootstrap

The Semi-Manual Way πŸ’ͺ

1. Install Command Line Tools

Download and install XCode or the XCode command line tools.

xcode-select --install

Installation

To provision your machine, open up Terminal and enter the following:

sudo xcodebuild -license
xcode-select --install
git clone https://github.com/LyraPhase/sprout-wrap.git
cd sprout-wrap

2. Ruby Installation

Install RVM
bash -c "./bootstrap-scripts/bootstrap-rvm.sh $USER"
export PATH="$PATH:$HOME/.rvm/bin"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
sprout_ruby_version=$(tr -d '\n' < "${REPO_BASE}/.ruby-version")
sprout_ruby_gemset=$(tr -d '\n' < "${REPO_BASE}/.ruby-gemset")
sprout_rubygems_ver=$(tr -d '\n' < "${REPO_BASE}/.rubygems-version") ## Passed to gem update --system
sprout_bundler_ver=$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1 | tr -d '[:blank:]')
Install Ruby
# Install Ruby, Create Gemset and install Bundler + RubyGems
## NOTE: You might need to set compilation options for native gem extensions (e.g.: libffi, nokogiri)
rvm install "ruby-${sprout_ruby_version}"
rvm use "ruby-${sprout_ruby_version}"
rvm gemset create "$sprout_ruby_gemset"
rvm use "ruby-${sprout_ruby_version}"@"${sprout_ruby_gemset}"
rvm "${sprout_ruby_version}" do gem update --system "${sprout_rubygems_ver}"
rvm "${sprout_ruby_version}" do gem install --default "bundler:${sprout_bundler_ver}"
if ! bundle list | grep -q "bundler.*${sprout_bundler_ver}"; then
  bundle exec gem install --default "bundler:${sprout_bundler_ver}"
fi
Install Gems
bundle config set --local path 'vendor/bundle' ;
bundle config set --local without 'development' ;
bundle install
Run Sprout
caffeinate ./sprout

The caffeinate command will keep your computer awake while installing; depending on your network connection, soloistrc, and run_list, soloist can take from 10 minutes to 2 hours to complete.

Problems?

ObjectiveC Fork Error

As of macOS 10.14, the behavior of underlying ObjectiveC macOS Foundation framework changed. (Big surprise, Apple changes fundamental development platform dependencies so often it causes many things to break πŸŽπŸ’©)

This results in the following errors:

objc[37813]: +[__NSPlaceholderDictionary initialize] may have been in progress in another thread when fork() was called.
objc[37813]: +[__NSPlaceholderDictionary initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
[2020-07-20T16:25:31-06:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process terminated by signal 6 (IOT)
[2020-07-20T16:25:31-06:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process terminated by signal 6 (IOT)

The workaround is to run soloist / chef-solo with the following environment variable:

export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
bundle exec soloist run_recipe homebrew::install_casks ## For example

clang error

If you receive errors like this:

clang: error: unknown argument: '-multiply_definedsuppress'

then try downgrading those errors like this:

sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future bundle

Command Line Tool Update Server

If you receive a message about the update server being unavailable and are on Mavericks, then you already have the command line tools.

Customization

This project uses soloist and librarian-chef to run a subset of the recipes in sprout's cookbooks.

Fork it to customize its attributes in soloistrc and the list of recipes you'd like to use for your team. You may also want to add other cookbooks to its Cheffile, perhaps one of the many community cookbooks. By default it configures an macOS workstation for development and as a Digital Audio Workstation environment.

Finally, if you've never used Chef before - we highly recommend you buy & watch this excellent 17 minute screencast by Ryan Bates.

Caveats

Homebrew

  • Homebrew path prefix has changed on Apple Silicon to /opt/homebrew. You may encounter issues after migrating from an Intel Mac unless running under Rosetta Terminal.app. Fresh installs on arm64 based hardware will use the new location and compile natively for Apple Silicon.
  • Homebrew cask has been integrated with Homebrew proper. If you are experiencing problems installing casks and have an older installation of Homebrew, running brew uninstall --force brew-cask; brew update should fix things.
  • If you are updating from an older version of sprout-wrap, your homebrew configuration in soloistrc might be under node_attributes.sprout.homebrew.formulae and node_attributes.sprout.homebrew.casks. These will need to be updated to node_attributes.homebrew.formulas (note the change from formulae to formulas) and node_attributes.homebrew.casks.

Development Tips & Tricks

Some helpful commands and tricks to know when working on this repo:

  1. To run bootstrap.sh with a custom soloistrc:

     export SOLOISTRC='soloistrc.lyra.yml'
    
  2. To test bootstrap.sh curl piped to bash mode on a development branch (with set -x trace mode):

     export SPROUT_WRAP_BRANCH=my-feature-branch
     export SOLOISTRC=soloistrc.my-feature-test
     \curl -Ls https://raw.githubusercontent.com/LyraPhase/sprout-wrap/${SPROUT_WRAP_BRANCH}/bootstrap-scripts/bootstrap.sh | bash -x
    
  3. To replicate what bootstrap CI workflow does:

     export CI=true
     # Ensure you have same Ruby + RubyGems + Bundler versions
     bundle install
     bundle exec make bootstrap
    
  4. To replicate what test CI workflow does:

     export CI=true
     # Ensure you have same Ruby + RubyGems + Bundler versions
     bundle install
     bundle exec make test
    
  5. To run sprout:

     make sprout
    
  6. For extra Makefile targets:

     make help
    
  7. To clear GitHub Actions Cache (invalidates hash key prefix):

     make clear-github-cache
    

Roadmap

See LyraPhase Sprout Project Tracker: https://github.com/orgs/LyraPhase/projects/1

Discussion List

Join LyraPhase/sprout-wrap Discussions to discuss this fork. You might also want to join [email protected] if you use Sprout. (Note: This may not be very active anymore)

References

About

Scripts to prepare a Mac for Ruby / Python / Ansible / Chef / Intel Edison IoT development

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 69.5%
  • Ruby 21.9%
  • Makefile 8.6%