Other developers may as well use zsh or some other kind of shell. All you want is only load RVM environment, nothing else. If you have a lot of developers on the team, they may have all kinds of things happening in their ~/.bash_profile which you don’t necessarily want to run in Xcode build phase. However, it will not work for Bourne shell (sh).īut the it will work for the Bourne-again shell (bash), so you could change “Shell” parameter to say /bin/bash -l. It’s as simple as adding -l to the “Shell” parameter of the build phase, for example /bin/sh -l. One solution to this problem is to use login shell. None of the RVM environment usually defined in shell profile got loaded into script. On Mojave OS X the output will be 2.3.7, which is the system Ruby version. Now add ruby -version to the build phase, build the project and check the output. You are also using RVM to install and use version 2.5.x. The script happens to be using some 2.5.x Ruby language features, which are not available in 2.3.x. The ExampleĪs an example, let’s say you’ve got a Ruby script which you want to run as part of Xcode build phase. It is not actually not a bug, but an expected behavior, which may confuse you a bit though. ![]() The reason is that a shell ran from Xcode build phase is non-interactive shell. None of the messages from shell profiles will show up. Then run the build phase by building Xcode project. ![]() Try to put the following in your shell profiles ~/.profile: The problem is that shell scripts ran in Xcode build phases do not source the user shell profile. One of the tasks that a build phase can perform is running a shell script, and that’s where you can face one peculiar problem… The Problem If you’ve ever done iOS development you’ve surely used Xcode Build Phases. How to teach Xcode to respect the Environment.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |