#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
Gemfileif not create oneexample
Gemfilesource 'https://rubygems.org' gem 'cocoapods' gem 'cocoapods-keys' gem 'redcarpet' gem 'rswift-ios' -
Now there are two scenarios:
-
you have
BUNDLE_PATHdefined 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 installwhich will install gems fromGemfileto `your_app_dir/.gems' -
you don't have
BUNDLE_PATHdefined inyour_app_dir/.bundle/config. This is most likely situation. Then instead of regularbundle installyou have to typebundle install --path .gems. This will defineBUNDLE_PATHinyour_app_dir/.bundle/configand install missing gems.
-
-
Now
bundlewill 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.--pathwill be deprecated soon.