-bash: git: command not found in Xcode 4 in lion osx - ios

Through Xcode 4.3 ->file -> source control -> repositories -> clone repository, I've cloned a repository from codesion.com. but when I go a git init or git add, the error -bash: git: command not found shows up. Now, Xcode 4.3 comes with the git installed, so what should I do to get this working?
Any help on this would be great.
Thanks in advance.

There is another option if you're not experienced with UNIX or you just don't want to mess with the system variables from the terminal. I had the same problem, and after some reading on SO and apple developer pages I've decided to install the Command Line Tools for Xcode. That solved the problem.
As the Xcode IDE from some 4.x version is an .app package and everything is stored inside that package, they have added the possibility to separately install the command line tools so that you have the command line tools inside the usr/bin/ path.
You can install the command line tools (as well as some other tools and documentation) from the Downloads tab of the Preferences window in Xcode (I have version 4.3), or from the apple developer website.

It's a path issue. See this question for the answer:
How to move GCC in osx from xcode to /usr/bin
(P.S. The question is different, but the answer the same.)

Related

Carthage requires git 2.3.0 or later

I am using charts library and trying to run the demo. Before running I have to install the dependencies using Carthage. I goto project folder location and type in terminal:
carthage update
I got the below error:-
Carthage requires git 2.3.0 or later.
How to install Carthage decencies and run the above said demo.
Select Command Line Tools to the latest version of Xcode.
Xcode -> Preferences -> Locations -> Command Line Tools
Open Preferences shortcut : Command + comma ⌘ + ,
It seems like you have used another Xcode version since last time. You should set command line tool again by running the following in terminal:
sudo xcode-select -s <path to Xcode>/Contents/Developer
for example:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
Not sure if this will help, but I ran into the same issue and found out that xcodebuild is using a different Xcode that I installed.
so you can probably double check which Xcode you are using:
xcode-select --print-path
Here is the original post that helped me solving this issue:
Change Carthage Swift version
It seems you have to install new version of git.
brew install git
It could say "Target /usr/local/bin/git
already exists. You may want to remove it". I didn't want to remove it and decided only to overwrite:
brew link --overwrite git
It helped me with the same issue. I hope it will help to someone else.

Appium doctor shows error

When I run Appium doctor it shows:
Running iOS Checks
✖ Unknown SW Version Command: Error: Command failed: /bin/sh -c sw_vers -productVersion
/bin/sh: sw_vers: command not found
Appium-Doctor detected problems. Please fix and rerun Appium-Doctor.
Can anyone help let me know what is the wrong here?
running this solved my problem:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
You need to install the command line tools as marked in your message:
✖ Xcode Command Line Tools are NOT installed
From osxDaily:
Launch the Terminal, found in /Applications/Utilities/
Type the following command string:
xcode-select --install
A software update popup window will appear that asks: “The xcode-select command requires the command line developer tools. Would you like to install the tools now?” choose to confirm this by clicking “Install”, then agree to the Terms of Service when requested (feel free to read them thoroughly, we’ll be here)
Wait for the Command Line Tools package download to complete, it’ll be about 130MB and installs fairly quickly depending on your connection speed
The installer goes away on its own when complete, and you can then confirm everything is working by trying to use one of the commands that were just installed, like gcc, git, svn, rebase, make, ld, otool, nm, whatever you want from the list below. Assuming the installation went uninterrupted, the command will execute as expected. This also means you can compile and install things from source code directly without having to use a package manager. Enjoy your new unix command line toolkit!
Have you tried upgrading to the latest Appium version? Are you installing Appium through terminal? My appium-doctor issues were fixed after I installed Appium through terminal and updated the path variables in .bash profile. Appium desktop application is different than one installed through command line.
There are only two possible area which causing that error:
You need to keep all path veriable updated and correct in .bash_profile
You must install
XCode
NodeJS
properly. You must have all permission to access those.
Install all latest version of following things
JDK (Java Development Kit),
Xcode ,
Command Line tools ,
APPIUM For MAC OS
In my case, xcode command line tool isn't set. Simply go to Xcode>Preferences>Locations>Select desired Xcode version in Command Line Tools. OR from terminal follow Chhagan's answer xcode-select -s your path

Manual Install of Xcode command line tools not working

I've manually installed the Xcode command line tools from the Apple website, and I went through the install process but it doesn't seem to be working. I ran this from the terminal to see if it installed:
Zach-Boyette-MacBook-Pro-2:~ zachboyette$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 5.1.0.0.1.1396320587
volume: /
location: /
install-time: 1398301024
groups: com.apple.FindSystemFiles.pkg-group com.apple.DevToolsBoth.pkg-group com.apple.DevToolsNonRelocatableShared.pkg-group
So it looks like the command line tools have installed, but when I run this:
Zach-Boyette-MacBook-Pro-2:~ zachboyette$ xcode-select --install
A popup says: The "xcode-select" command requires the command line developer tools. Would you like to install the tools now?
I clicked install and then it said: Can't install the software because it is not currently available from the Software Update server.
I've read on other answers that the solution is to do a manual install, but I just did that so I don't understand why it's not working. Also, in Xcode downloads, it's not showing the Command Line Tools.
I've tried installing it manually many times so I don't know why it's not working.
Installing Jekyll still won't work:
Zach-Boyette-MacBook-Pro-2:~ zachboyette$ sudo gem install jekyll
Password:
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
EDIT: echo $PATH returns this:
Zach-Boyette-MacBook-Pro-2:~ zachboyette$ echo $PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/zachboyette/.rvm/bin
Command Line Tools are not included in XCode 5.1.1
You have to install it manually, BUT DON'T USE "xcode-select --install". It does not work.
Open Xcode app.
Click on Xcode > Open Developer Tools > More Developers Tools.
That will take you to Downloads for Apple Developers web site.
Use your AppStore Id to login.
Download Command Line Tools for your Mac OS X version.
I have stumbled across this issue before when I completely hosed my development environment by deleting an ancient Xcode version.
Have you tried running sudo xcode-select -r to clean up? This sorted my problem.
From the man page:
-r, --reset
Unsets any user-specified developer directory, so that the
developer directory will be found via the default search mecha-
nism. This command must be run with superuser permissions (see
sudo(8)), and will affect all users on the system.
The easiest work around is to install the XCode app from the App Store then open XCode and agree to the Terms and Conditions.
From there the Command Line Developer Tools package can be installed on using xcode-select --install or by trying to use any command line developer tool in Terminal like git.

Command line tools download in Xcode disappeared after Mavericks

After having installed Mavericks I got this problem on a code that compiled without problems before.
xcode-select --install triggers the installation without any strange problems,
yet when I try to build something with Eclipse it gives me
"Include path not found (/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/include)"
Infact in /Applications/Xcode.app/Contents/Developer/usr/ there's no llvm-gcc-4.2.
How can I fix this?
On my system in terminal:
/usr/bin/llvm-gcc-4.2
produces:
/usr/bin/llvm-gcc-4.2
/usr/bin/llvm-gcc-4.2
is linked to :
/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2
Also
$ which llvm-gcc
produces:
/usr/bin/llvm-gcc
and
/usr/bin/llvm-gcc is linked to /usr/bin/clang
Note that Apple no longer provides llvm-gcc as an option in Xcode so perhaps it is no longer supplied as a command-line tool.
I had problems with the command line tools as well after upgrading to Mavericks, despite having updated Xcode, and I am quite sure I also installed the command line tools. Still, you can add them "by hand" downloading from apple site. I am not sure if it is any sort of bug of such, but anyway, I recommend you to download the latest Mavericks' Command Line Tools (late October) on Apple's developer site (needs free registration)

How to enable Source Control in existing iOS project?

As in the topic - i have a project that doesn't have Source Control enabled, so how (and if) can i enable it now? I use Snapshots but the project became a big one, and now i need some more "pro" tools. I'm still rather an xcode beginner, so please explain it like i was a cow.
First off you'll have to install the command line tools for github. You can do so from this link http://mac.github.com/, then either during setup it will ask you to install command line tools, or if it doesn't, you can do it from the preferences menu. Once this is completed, you will be able to follow the instructions on this website to convert your project: conversion tutorial. After all that is done, this website explains everything you could possibly want to know about Source Control and all you can do with it.
EDIT
If you do not want to install github for the command line tools, you can install Homebrew, which is a package manager (macs equivalent to apt-get), then run brew install git for the latest version of git.
After doing a git init,go you the projects tab in the Organizer (top right corner in xcode) There remove the reference to your project and restart xcode to update the changes. Removing the project from Organizer will not delete any files, it will only clear the caches.
I am not sure how to do this from within XCode, but if you are on OSX you can easily initialize git from the command line (within Terminal). From the base directory of the project invoke git init.
Once the project is associated with a git repository, XCode should recognize that and you will see the project listed among the repositories in XCode's Organizer (available from the Window -> Organizer menu)
To upload the project into github, look at the directions here: https://help.github.com/articles/create-a-repo

Resources