#How to use Bundler with iOS projects
You probably stuck with situation when after finishing for example bundle install && bundle exec pod install
Bundler couldn't access gems which he just download. Some of you may think "RVM is the answer!" and yes it is, but what if it is not?
##Don't use macOS's gems. Just DON'T.
-
Establish that you will don't use macOS's gems and RVM.
-
Go to
your_app_dir
-
Make sure you have
Gemfile
if not create oneexample
Gemfile
source 'https://rubygems.org' gem 'cocoapods' gem 'cocoapods-keys' gem 'redcarpet' gem 'rswift-ios'
-
Now there are two scenarios:
-
you have
BUNDLE_PATH
defined inyour_app_dir/.bundle/config
.example
your_app_dir/.bundle/config
--- BUNDLE_PATH: ".gems" BUNDLE_DISABLE_SHARED_GEMS: "true"
So then you just type
bundle install
which will install gems fromGemfile
to `your_app_dir/.gems' -
you don't have
BUNDLE_PATH
defined inyour_app_dir/.bundle/config
. This is most likely situation. Then instead of regularbundle install
you have to typebundle install --path .gems
. This will defineBUNDLE_PATH
inyour_app_dir/.bundle/config
and install missing gems.
-
-
Now
bundle
will use.gems
(or other dir) by default and will not interfere with system gems.
They recommend to use
bundle config set path '.gems'
, following bybundle install
.--path
will be deprecated soon.