I started the pre integration trigger with the following
cd "${XCS_PRIMARY_REPO_DIR}"
pwd
pod install --verbose
And it gave me
pod: command not found
Simple right? Can't find the pod binary so, I'll just point it over to the path. Easy.
cd "${XCS_PRIMARY_REPO_DIR}"
pwd
/usr/local/bin/pod install --verbose
Which gives me the following
env: ruby_executable_hooks: No such file or directory
This makes me think ruby isn't set up right to run for the triggers. Now understand a simple "pod install" in the terminal of the build server fixes all this and runs fine and dandy. The project definitely builds properly on the build server.
So since I think the environment is messed up, I'll try to run it from the wrapper directory, that should set up good and nice. That's what it's made for right? This worked historically whenever I needed ruby to run in a run script phase of the build. So here we go on the trigger.
~/.rvm/wrappers/ruby-2.2.3#global/pod install
I test this one in the terminal of the build server and it's cool with it, so I put it into the trigger and I get this
/Users/XcodeServer/.rvm/wrappers/ruby-2.2.3#global/pod: line 7: exec: pod: not found
:/ Alright I crack up the pod source and see what it says on line 7
exec pod "$#"
I'm not a ruby person but it didn't mean anything to me. Oh yeah and I tried downloading cocoapods directly into usr/local/bin, rather than letting it install into some other directory, by first uninstalling all cocoapods and then by doing the following
sudo gem install -n /usr/local/bin cocoapods --pre
I put --pre because I needed 1.1.0.rc.2 to fix a bug with building swift 3. Any who, it all doesn't work. It seems like everyone else can simply put
cd /path/to/proj/
pod install
into their Xcode bot triggers and have them work.
I had the trigger run a script on the build server that did the pod install.
So make a shell script on your build server that has the following:
#make sure the encoding is correct
export LANG=en_US.UTF-8
# fix the path so Ruby can find it's binaries
export PATH=/usr/local/bin:$PATH
echo "PATH: $PATH"
# update or install depending on what we got
if [ -d ${PODS_DIR} ]; then
# pods directory exist
echo "=================="
echo " Delete Pods"
echo "=================="
# delete cocoapods files if they exist
rm -rf "${PODS_DIR}"
eval rm "${BS_SRCROOT}/Podfile.lock"
eval rm -rf "${BS_SRCROOT}/${BS_EXECUTABLE_NAME}.workspace"
echo "Deleted Pods directory ${PODS_DIR}"
echo "Deleted ${BS_EXECUTABLE_NAME}.workspace"
echo "Deleted Podfile.lock"
else
# no need to delete pod files
echo "Pods NOT detected at ${PODS_DIR}"
fi
echo "=================="
echo " Install Pods"
echo "=================="
# make sure we are where we need to be
eval cd "${BS_SRCROOT}"
pwd
~/.rvm/wrappers/ruby-2.2.3#global/pod install
Remember to use the 'sh' suffix when naming the script. And then in your bot trigger run the script like this
sh ~/Path/to/Scripts/podUpdateHack.sh
Kind of silly but it works, ¯\_(ツ)_/¯ Oh yeah all those dumb evals are there because the BS_SRCROOT is an environment variable on XCode bots, which references the environment variable $XCS_PRIMARY_REPO_DIR. You can just replace it with $XCS_PRIMARY_REPO_DIR and remove the eval. I don't remember who defines PODS_DIR that might be from the workspace and BS_EXECUTABLE_NAME is a redefinition of the executable name from the project since it doesn't exist at this point in time.
Hope that helps homie.
#!/bin/sh
cd ProjectDirectory
/usr/local/bin/pod install
Set the default path, execute the .bash_profile and then your bot runs just like a normal user
#!/bin/sh
cd $XCS_PRIMARY_REPO_DIR
PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands"
. ~/.bash_profile
bundle install
pod install --repo-update
P.s. bundle install installs all gems specified in my Gemfile which looks like this (So you can have different gem requirements per bot):
source 'https://rubygems.org'
gem 'cocoapods', '1.3.1'
Related
I was trying to install jekyll in my Mac and got the warning as following:
WARNING: You don't have /Users/Carrot/.gem/ruby/2.3.0/bin in
your PATH, gem executables will not run.
I checked through gem list and it shows it is installed; and I can find the jekyll through the path "/Users/Carrot/.gem/ruby/2.3.0/bin". I read a post which seems like my situation. I would like to know if it's a must to go through sudo? I now prefer to uninstall everything (since it also installed sass and bunch of things at the same time) and go through homebrew. How can I do the uninstallation?
Many thanks!
For those who have problems with #lamech-desai answer, (actually, when they do Desai's commands, it apparently works temporarily for them).
So you can easily do these:
open ~/.bshrc if you would like to use bash or ~/.zshrc if your are using zsh or etc...
$ sudo nano .bashrc ## bash users
$ sudo nano .zshrc ## zsh users
then copy and past these two lines of code at the end of the .*rc file:
export GEM_HOME="$(ruby -e 'puts Gem.user_dir')"
export PATH="$PATH:$GEM_HOME/bin"
then simply press ctrl+s and ctrl+x. This will save the changes to .bashrc but you won't see them immediately - directly on your next shell login with your current user. One way to see the changes immediately is to switch user to root with su root and then switch back to your previous user with su <username> - and voila, your .bashrc will be reloaded. You can also check this with echo $PATH.
Thanks to #lamech-desai for great answer
If you are using arch linux just use the commands below in your terminal
[user~]$ export GEM_HOME="$(ruby -e 'puts Gem.user_dir')"
[user~]$ export PATH="$PATH:$GEM_HOME/bin"
[user~]$ gem list
[user~]$ gem update
You need to add the directory to your PATH environment variable
https://askubuntu.com/questions/406643/warning-you-dont-have-a-directory-in-your-path-gem-executables-will-not-run
If you are on a Mac like me, you need to add the PATH to the PATH environmental variable. You can do it with export command:
export PATH="/Users/Carrot/.gem/ruby/2.3.0/bin:$PATH"
If you wanna know more about this process, here is a blog post about this: Adding a Path to the Linux PATH Variable
Probably a bit odd to answer my own question but I did finally fix it somehow like a blind fly. I hope to write down the experience maybe who else is totally like me as a absolute beginner with everything wouldn't get struggling overnight.
Stage 1: from gem to homebrew (failed)
At the beginning, I did remove items that install in gem item-by-item, then I install brew-gem to do it. At some stage, it work for jekyll but not my theme. It kept popping out I didn't install a package that the theme needs even I installed it manually. So in the end, I remove everything related to jekyll from homebrew.
Stage 2: back to gem (very long path but finally made it)
I later found a page tell step-by-step to install jekyll. I am using OSX 10.13 (High Sierra) that cause me the permission problem. So I just granted access with this line:
sudo chown -R $(whoami) /usr/local/*
The * is a must or it won't work. I did the same to the ruby part
sudo chown -R $(whoami) /Library/Ruby/Gems/2.3.0/*
After that I install jekyll and bundler carefully following the instruction. And install the packages that the theme needs manually through gem install, which you can find at the Gemfile. I got the problem of jekyll-sitemap similar as this, I followed the method to install pygment.rb through gem install pygments.rb. And now my site is locally work.
I have a Rails application running on Heroku. My application calls a CLI tool (on my local machine) that was installed via Makefile. I need this Makefile installed on my Heroku application so that it's available to all my application instances.
How can I have heroku install this makefile on deploy? I'm able to accomplish this on CircleCI by passing it some pre-deploy arguments in their config file:
cd vendor/liblouis ; ./configure ; make ; sudo make install
Does Heroku offer something similar?
I reached out to their support, but they pointed me to some buildpack for makefiles. This won't work (I think) because it wont allows me to run ./configure
I think it is doable, but will require some work and it will be hard to give you straightforward solution. You should definitely use a buildpack and compile everything during build phase. I found this buildpack. I don't know if this is a recommended one, but it can be a good starting point.
It is true that it won't run configure, but you can actually fork it and modify it in a way that you want. You just need to be smart about configuring all the paths. Installing in /usr/bin or something like that won't work. Also you should probably use make install instead of sudo make install.
Inside this buildpack you have access to 3 directories: build, cache and env. You need to install your executable or library in build directory.
I believe you can practice on one-off dyno before modifying this buildpack. Just run heroku run bash and try to compile your Makefile.
So I was able to get this working, but had to create my own custom buildpack. Buildpacks are a lot simpler than I thought, but I forked an existing one and edited it to work for my case. I stored my makefiles in the vendor directory of my application.
In the buildpack, I have the following code:
#!/usr/bin/env bash
# bin/compile <build-dir> <cache-dir>
set -e
set -o pipefail
BUILD_DIR=$1
CACHE_DIR=$2
function indent() {
c='s/^/ /'
case $(uname) in
Darwin) sed -l "$c";;
*) sed -u "$c";;
esac
}
cd $BUILD_DIR/vendor/liblouis
# autoreconfig
echo "-----> Running autoreconfig"
autoreconf -f -i 2>&1 | indent
# configure
if [ -f configure ]; then
echo "-----> Configuring"
./configure --prefix=$BUILD_DIR/vendor/liblouis-exec 2>&1 | indent
fi
# make
echo "-----> Compiling with Make"
make 2>&1 | indent
# make install
echo "-----> Installing with Make"
make install 2>&1 | indent
I pushed the buildpack to my own repo, and then added the buildpack to my heroku application with
heroku buildpacks:add https://github.com/KidA001/heroku-buildpack-c
I also had to create a .profile file in the root directory of my application add add a link to a file which needed to be linked to a shared library
.profile
export LD_LIBRARY_PATH=$HOME/vendor/liblouis-exec/lib
Now I can call this CLI tool that was installed in this buildpack, and it's available on all of my app instances on heroku.
I found an issue when running sudo pod install command after updating it to latest version 0.32.1. Earlier it was working very fine.
When I tried to do pod install with older cocoapods, it asked me to update to latest cocoapods version i.e. 0.32.1. After I updated by cocoapods gem, I can't do sudo pod install in my Xcode project. It gives me following error.
± sudo pod install ruby-1.9.3-p0
Password:
/Users/username/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/gems/1.9.1/gems/claide-0.5.0/lib/claide/command.rb:328:in `help!': [!] You cannot run CocoaPods as root. (CLAide::Help)
CocoaPods, the Objective-C library package manager.
Commands:....
Any suggestion to overcome the issue would be very helpful. Thanks in advance.
I had to update permission on CocoaPods
sudo chown -R $USER ~/Library/Caches/CocoaPods
sudo chown -R $USER ~/.cocoapods
Since it seems to fix the problem for some people, you might want to try running "pod install" and see if it fixed your problem from that point. However, I still had a permission denied when running "pod install" for a pod item, so running the next line will overwrite permission for the pod folder.
sudo chown -R $USER ./Pods
I have removed the old podfile.lock before running pod install
Source :
cocoaPods pod install Permission denied
https://github.com/CocoaPods/CocoaPods/issues/509
I am working with windows. After reading all tips which didn't work I drove into the code base.
As a disclaimer, I am beginning phase of developing an app and my goal is to get a quick proof of concept. Therefore, this solution will only bypass that the error message as a quick hack.
In the file ~/lib/cocoapods/command.rb you will find a function on line 47 that stops the program if there is a root user.
#help! 'You cannot run CocoaPods as root.' if Process.uid == 0
Simply comment out the line. Again, this is a terrible idea to do in any situation except as a pragmatist using Windows and trying to get proof of concept out.
Nothing worked for me except the following
switched to ios platform with cd platforms/ios
switched ownership of the folder to the current user with sudo chown -R YourUsername .
Pod install
In m1 MACs run sudo arch -x86_64 pod install --allow-root to resolve this issue.
in my case, the both "folder content project" and file "project.xcodeproj" was locked "i ignore why !!! maybe the git clone provoked error :s", i unlock the folder and apply all changes for sub folder .... And it WORK FINE :D
I have a working project the uses a pod file for some weeks now. When I learned that some of my pods have update I tried to 'pod install' on got this weird error
Analyzing dependencies
[!] Pod::Executable pull
Updating 1337455..e9f6e93
error: The following untracked working tree files would be overwritten by merge:
AeroGear-Push/0.7.0/AeroGear-Push.podspec
AeroGear/1.2.0/AeroGear.podspec
BrynKit/1.3.0/BrynKit.podspec
BrynKit/1.3.1/BrynKit.podspec
CSURITemplate/0.3/CSURITemplate.podspec
EXiLE/1.0.2/EXiLE.podspec
FlurrySDK/4.2.3/FlurrySDK.podspec
FoundationExtension/0.39.1/FoundationExtension.podspec
FoundationExtension/0.39/FoundationExtension.podspec
GCDObjects/0.0.1/GCDObjects.podspec
HTAutocompleteTextField/1.2.1/HTAutocompleteTextField.podspec
HTAutocompleteTextField/1.2.2/HTAutocompleteTextField.podspec
HTAutocompleteTextField/1.2/HTAutocompleteTextField.podspec
IDMPhotoBrowser/1.1.2/IDMPhotoBrowser.podspec
Igor/0.5.0/Igor.podspec
KFOpenWeatherMapAPI/0.2.0/KFOpenWeatherMapAPI.podspec
NGSegmentedViewController/0.1.1/NGSegmentedViewController.podspec
PPiFlatSegmentedControl/1.3/PPiFlatSegmentedControl.podspec
PiwikTracker/2.0.0/PiwikTracker.podspec
SDWebImage/3.4/SDWebImage.podspec
libwbxml/0.11.2/libwbxml.podspec
wbxml/0.0.1/wbxml.podspec
Please move or remove them before you can merge.
Aborting
another post suggested using the 'rm -rf ~/.cocoapods' command line
but this caused my cocoapods to stop working all together for all project
now which ever project I try to 'pod install' I get the 'Unable to find a specification for..' error
[!] Unable to find a specification for CorePlot (= 1.3).
If you landed here on or after January 30th 2014, there is a break in CocoaPods causing this. Please read the related blog post found here: http://blog.cocoapods.org/Repairing-Our-Broken-Specs-Repository/
or do:
pod repo remove master
pod setup
The solution is to use $sudo rm -rf ~/.cocoapods to clean the cocoapods master repo and then pod install worked without any problems.
The 100% dead-work one-line command is:
sudo rm -rf ~/.cocoapods && pod setup && pod install
I created the issue on GitHub traker:#2185
And the official answer is:
This is issue which has already been
fixed by #irrationalfab with commit CocoaPods/CLAide#5e023ab.
So the fix should be available in the next release of CocoaPods. Just be patient
If you need a clean master spec repo you can try
cd ~/.cocoapods/master
git reset --hard
or if you're on CocoaPods 0.23+, use ~/.cocoapods/repos/master.
You are going to have to manually delete any local copies of the Specs repository and re-clone the new version of the Specs repository. You can do that with the following commands:
$ sudo rm -fr ~/.cocoapods/repos/master
$ pod setup
when my projects get big and I have a large pod file, I run into this problem quite a bit.
My solution is as follows :
pod repo remove master
pod setup
pod install
You need to fix permissions and files owner
$ sudo chown -R user ~/Library/Caches/CocoaPods
$ sudo chown -R user ./Pods
$ sudo chown -R user ./Podfile.lock
$ sudo chmod -R 777 ./Pods
$ pod update/setup
Wow this one has been a real pain and everyone seems to have a different solution. For me this solution worked on multiple machines/environments on a few occasions:
Apparently there is a bug with psych that is causing the problem.
sudo gem uninstall psych
sudo gem install psych -v 2.0.0
There's a lengthy conversation over on the CococaPods repo about the issue and this fix.
Just to share my own fix for this issue:
Since this is a git issue, you can use simple git commands to resolve it (See #AdamSharp's post). What worked for me was running
git clean -d -f
in ~/.cocoapods/repos/master. This recursively removes any untracked files and directories from the repo. I encourage you to run:
git clean -d -f --dry-run
Before you actually execute anything so you can see what it would do. Should it break your CocoaPods master repo, simply delete ~/.cocoapods/repos/master and run pod repo update.
You can try it like this.
pod spec lint --sources='https://git.oschina.net/yourname/jqcpodspec,https://github.com/CocoaPods/Specs' --allow-warnings --use-libraries
if your spec pass validation, then
pod repo push JQCPodSpec FMCommonModelLib.podspec --sources='https://git.oschina.net/yourname/jqcpodspec,https://github.com/CocoaPods/Specs' --allow-warnings --use-libraries
I'm having trouble installing RVM on a new Debian 6 VirtualBox VM. I've installed all the needed packages and downloaded the install script fine using
(curl -s https://rvm.beginrescueend.com/install/rvm) > rvm
, but when running it as a single user
bash rvm
I get the following error message:
ERROR: Unable to checkout branch .
Installation stops here, and (as far as I can tell) none of RVM's files are installed.
If I run the script as root (for a multi-user install), I get the other message:
Successfully checked out branch ''
The installer continues and indiciates success, but .rvm directories are not added and even after modifying my .bash_profile(s), I get 'rvm: command not found'.
I'm really stumped here. I don't have a ton of experience in either bash or with git, so I'm not sure if the fact that 'branch' is blank is the problem, or how to continue debugging. I'm here to learn, so please don't hesitate to ask questions so we can figure this out.
Thanks.
I had a /etc/rvmrc lying around that was confusing it. The rvm-installer was trying to install into /usr/local and failing. Deleting it fixed it.
Had the same problem.
Checked for /etc/rvmrc - but did not exist.
Did a ls -al, and found .rvm in my home directory.
Ran rm -rf .rvm
For the syntax error when install rvm on windows.
1. curl -s https://rvm.beginrescueend.com/install/rvm
2. sh rvm
and that did it!
You can try this. (it worked for me)
Set the rvm_path to be user-facing:
appuser$ echo 'rvm_path="$HOME/.rvm"' >> ~/.rvmrc
Now install RVM,
appuser$ curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer -o rvm-installer ; chmod +x rvm-installer ; ./rvm-installer
source :
http://beginrescueend.com/deployment/best-practices/