Skip to content

Instantly share code, notes, and snippets.

@jaysoffian
Last active March 29, 2023 23:02
Show Gist options
  • Save jaysoffian/8145a85d7d91b255270280fb7ec19605 to your computer and use it in GitHub Desktop.
Save jaysoffian/8145a85d7d91b255270280fb7ec19605 to your computer and use it in GitHub Desktop.
A script to install one or more gems in a self-contained directory, similar to installing Python packages in a virtual environment
Replaced by gem-venv.sh.
Please see https://gist.github.com/jaysoffian/3c67711d3f00c364365905d877cc4af4 instead.
@jaysoffian
Copy link
Author

Example usage:

[15:54:14]~$ gem-install.sh xcpretty
Installing gems to /Users/jaysoffian/xcpretty
gem is /usr/bin/gem
Gems to install:
  rouge-2.0.7
  xcpretty-0.3.0
Successfully installed rouge-2.0.7
Successfully installed xcpretty-0.3.0
2 gems installed
[15:54:23]~$ ./xcpretty/bin/xcpretty --version
0.3.0

Installing cocoapods which requires a downgraded version of activesupport to work with the system macOS Ruby 2.6:

[15:57:49]~$ gem-install.sh activesupport:6.1.7.3 cocoapods
Installing gems to /Users/jaysoffian/cocoapods
gem is /usr/bin/gem
Gems to install:
  concurrent-ruby-1.2.2
  i18n-1.12.0
  tzinfo-2.0.6
  zeitwerk-2.6.7
  minitest-5.18.0
  activesupport-6.1.7.3
Gems to install:
  concurrent-ruby-1.2.2
  i18n-1.12.0
  tzinfo-2.0.6
  minitest-5.18.0
  activesupport-7.0.4.3
  nap-1.1.0
  fuzzy_match-2.0.4
  httpclient-2.8.3
  json-2.1.0
  algoliasearch-1.27.5
  ffi-1.15.5
  ethon-0.16.0
  typhoeus-1.4.0
  netrc-0.11.0
  public_suffix-4.0.7
  addressable-2.8.1
  cocoapods-core-1.12.0
  claide-1.1.0
  cocoapods-deintegrate-1.0.5
  cocoapods-downloader-1.6.3
  cocoapods-plugins-1.0.0
  cocoapods-search-1.0.1
  cocoapods-trunk-1.6.0
  cocoapods-try-1.2.0
  molinillo-0.8.0
  atomos-0.1.3
  rexml-3.2.5
  CFPropertyList-3.0.6
  colored2-3.1.2
  nanaimo-0.3.0
  xcodeproj-1.22.0
  escape-0.0.4
  fourflusher-2.3.1
  gh_inspector-1.1.3
  ruby-macho-2.5.1
  cocoapods-1.12.0
Successfully installed concurrent-ruby-1.2.2
Successfully installed i18n-1.12.0
Successfully installed tzinfo-2.0.6
Successfully installed zeitwerk-2.6.7
Successfully installed minitest-5.18.0
Successfully installed activesupport-6.1.7.3
Successfully installed nap-1.1.0
Successfully installed fuzzy_match-2.0.4
Successfully installed httpclient-2.8.3
A new major version is available for Algolia! Please now use the https://rubygems.org/gems/algolia gem to get the latest features.
Successfully installed algoliasearch-1.27.5
Building native extensions. This could take a while...
Successfully installed ffi-1.15.5
Successfully installed ethon-0.16.0
Successfully installed typhoeus-1.4.0
Successfully installed netrc-0.11.0
Successfully installed public_suffix-4.0.7
Successfully installed addressable-2.8.1
Successfully installed cocoapods-core-1.12.0
Successfully installed claide-1.1.0
Successfully installed cocoapods-deintegrate-1.0.5
Successfully installed cocoapods-downloader-1.6.3
Successfully installed cocoapods-plugins-1.0.0
Successfully installed cocoapods-search-1.0.1
Successfully installed cocoapods-trunk-1.6.0
Successfully installed cocoapods-try-1.2.0
Successfully installed molinillo-0.8.0
Successfully installed atomos-0.1.3
Successfully installed rexml-3.2.5
Successfully installed CFPropertyList-3.0.6
Successfully installed colored2-3.1.2
Successfully installed nanaimo-0.3.0
Successfully installed xcodeproj-1.22.0
Successfully installed escape-0.0.4
Successfully installed fourflusher-2.3.1
Successfully installed gh_inspector-1.1.3
Successfully installed ruby-macho-2.5.1
Successfully installed cocoapods-1.12.0
36 gems installed
[15:58:11]~$ ./cocoapods/bin/pod --version
1.12.0

Installing an older version of cocoapods alongside the one we just installed:

[16:01:12]~$ gem-install.sh activesupport:6.1.7.3 cocoapods:1.11.3
Installing gems to /Users/jaysoffian/cocoapods-1.11.3
gem is /usr/bin/gem
Gems to install:
  concurrent-ruby-1.2.2
  i18n-1.12.0
  tzinfo-2.0.6
  zeitwerk-2.6.7
  minitest-5.18.0
  activesupport-6.1.7.3
Gems to install:
  concurrent-ruby-1.2.2
  i18n-1.12.0
  tzinfo-2.0.6
  zeitwerk-2.6.7
  minitest-5.18.0
  activesupport-6.1.7.3
  nap-1.1.0
  fuzzy_match-2.0.4
  httpclient-2.8.3
  json-2.1.0
  algoliasearch-1.27.5
  ffi-1.15.5
  ethon-0.16.0
  typhoeus-1.4.0
  netrc-0.11.0
  public_suffix-4.0.7
  addressable-2.8.1
  cocoapods-core-1.11.3
  claide-1.1.0
  cocoapods-deintegrate-1.0.5
  cocoapods-downloader-1.6.3
  cocoapods-plugins-1.0.0
  cocoapods-search-1.0.1
  cocoapods-trunk-1.6.0
  cocoapods-try-1.2.0
  molinillo-0.8.0
  atomos-0.1.3
  rexml-3.2.5
  CFPropertyList-3.0.6
  colored2-3.1.2
  nanaimo-0.3.0
  xcodeproj-1.22.0
  escape-0.0.4
  fourflusher-2.3.1
  gh_inspector-1.1.3
  ruby-macho-2.5.1
  cocoapods-1.11.3
Successfully installed concurrent-ruby-1.2.2
Successfully installed i18n-1.12.0
Successfully installed tzinfo-2.0.6
Successfully installed zeitwerk-2.6.7
Successfully installed minitest-5.18.0
Successfully installed activesupport-6.1.7.3
Successfully installed nap-1.1.0
Successfully installed fuzzy_match-2.0.4
Successfully installed httpclient-2.8.3
A new major version is available for Algolia! Please now use the https://rubygems.org/gems/algolia gem to get the latest features.
Successfully installed algoliasearch-1.27.5
Building native extensions. This could take a while...
Successfully installed ffi-1.15.5
Successfully installed ethon-0.16.0
Successfully installed typhoeus-1.4.0
Successfully installed netrc-0.11.0
Successfully installed public_suffix-4.0.7
Successfully installed addressable-2.8.1
Successfully installed cocoapods-core-1.11.3
Successfully installed claide-1.1.0
Successfully installed cocoapods-deintegrate-1.0.5
Successfully installed cocoapods-downloader-1.6.3
Successfully installed cocoapods-plugins-1.0.0
Successfully installed cocoapods-search-1.0.1
Successfully installed cocoapods-trunk-1.6.0
Successfully installed cocoapods-try-1.2.0
Successfully installed molinillo-0.8.0
Successfully installed atomos-0.1.3
Successfully installed rexml-3.2.5
Successfully installed CFPropertyList-3.0.6
Successfully installed colored2-3.1.2
Successfully installed nanaimo-0.3.0
Successfully installed xcodeproj-1.22.0
Successfully installed escape-0.0.4
Successfully installed fourflusher-2.3.1
Successfully installed gh_inspector-1.1.3
Successfully installed ruby-macho-2.5.1
Successfully installed cocoapods-1.11.3
36 gems installed
[16:01:40]~$ ./cocoapods-1.11.3/bin/pod --version
1.11.3

@jaysoffian
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment