Git and Xcode: Why do I have to agree to Xcode's T&Cs to use Git? - xcode

Git temporarily stopped working after I updated Xcode on my Mac. The message:
"Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo."
and then started working once I'd agreed to Xcode's T&Cs and installed the update.
Why, or should I say how, are the two linked?
I installed Git using the install.

Your git binary is provided by XCode (which is an easy way to get many command line tools packaged and maintained by Apple), and Apple wants you to accept their license before using any XCode component
If you don't like this, you can install it manually using Homebrew or similar. If you want to compile it yourself you will need a compiler for that. An easy way is using the one provided by XCode (see a pattern here?).
I've found that for my needs as a cross-platform Java-using-git developer the binaries provided by XCode are fine. This especially since they are automatically updated by Apple over time.

sudo xcodebuild -license will show you the license text of Xcode.
You have to agree its terms and condition at the end or you can just run the command given below.
sudo xcodebuild -license accept
P.S.- You are giving access to xcode.

In your terminal, run your git command as sudo
sudo git status
This will give you the option to view/accept the license agreements. Press enter to view it and press space until you get to the bottom. You can then type "agree" to agree to the license agreements. This will get rid of that message and you can use git again.

tl;dr try opening xcode and installing the plugins it suggests.
Even after I installed xcode, accepted the terms, and followed the developer tools prompt, it would continue to prompt me to install developer tools as if I didn't just do it. I eventually found a thread on reddit that suggested opening xcode and going through the recommended plugin installtion that comes up and that worked for me.

Related

“qmake” cannot be opened because the developer cannot be verified

I'm trying to install the omnetpp simulator abut I was not able to use its graphic interface. To run it properly I have to install Qt5 which I did through homebrew. My Qt version is 5.15.0 and my MacOS is Catalina (10.15.5 (19F101)).
When running the ./configure command to install omnetpp, I got the following error:
“qmake” cannot be opened because the developer cannot be verified.
In summary I had problems with the omnetpp when trying to run the graphic interface Qt, then I've installed Qt5 and now I get an error telling me that qmake cannot be verified.
Thanks,
The problem is that this will come many times... It has something to do with the new security settings for MacOS Catalina.
I found another work-around, which worked very well for me. Go to Systems Preferences -> Security and Privacy -> Privacy. Scroll down the left menu to Developer Tools and allow Terminal to run software locally (tick the box).
I was able to circumvent this problem by opening System Preferences, Security & Privacy, General, and then allowing the file to be executed. When I ran make again the Qmake command ran without any warnings or windows popping up.
According to Apple's website, you need to find qmake in the Finder, CTRL+click on it and press "Open". After that, qmake will be marked as an authorized app and you can run ./configure again.
I am a Windows user and could find the official Apple support page (https://support.apple.com/de-de/guide/mac-help/mh40616/mac) within a minute of googling, by the way.
You can run the following command to "un-quarantine" your binary (assuming its path is /usr/bin/qmake):
xattr -w com.apple.quarantine "00c1;$(xattr -p com.apple.quarantine /usr/bin/qmake | cut -d";" -f2-4)" /usr/bin/qmake

Why can't I run git commands after updating to OSX 10.10?

I upgraded from OSX 10.9 to 10.10. When I try to
git status
I get
Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
Why do I have to accept a new TOS to run git? Is there a workaround to accepting new Xcode TOS?
I know that I could simply open up Xcode and accept the new user agreement and carry on. I plan on using Xcode in the future and have no specific objections to using it. Wondering how a developer could, hypothetically, choose to continue running git should they disagree with Xcode's new TOS.
If you find that which git returns /Library/Developer/CommandLineTools/usr/bin then you are dependent on xcode functionality and its associated TOS.
If you install through another mechanism, brew or via GitHub command line tools, you would not receive this prompt. You may want to make sure your other version is earlier in your path:
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Mac installing libraries using the terminal

I have researched this and found answers on SO on this topic yet remain confused.
Trying to get started with Git. I'm new to shell scripting too so hopefully after this I'll be more familiar with it.
I'm reading this page about how to get up and running with Git: http://git-scm.com/book/en/Getting-Started-Installing-Git
I created a directory on my desktop called "git" and navigated to it in the terminal. With my level of experience in shell scripting this was a victory. Then, following a blog post on how to download fromt he terminal ran this command:
curl -O http://git-scm.com/download
That worked, or at least a new file was added to the "git" directory that I created.
Reading down the instructions one is told that "To install Git, you need to have the following libraries that Git depends on: curl, zlib, openssl, expat, and libiconv"
OK. Um. How? I did read some blog posts and SO answers on how to do this but failed. The first one for example - type zlib and hit enter - command not found? How do I either check if it's already installed or how do I install it? What about the others?
I tried following this blog post: http://www.neuraladvance.com/using-open-source-libraries-on-mac-os-x.html
I typed:
./configure
make
sudo make install
Wasn't even sure what to expect. The first two commands said not found the last one asked me for a password.
I then tried ./configure --help
Was then told "No such file or directory"
Needless to say I don't know what to do next. How do I install the libraries on a Mac using the terminal? curl, zlib, openssl, expat, and libiconv
I'm pretty sure all those libraries are preinstalled on your Mac.
If not, installing Xcode (free on the AppStore) would do the trick.
Xcode actually comes with git (but not the latest version) so if you install Xcode you don't need to install git separately.
To answer your question more generally, you might want to install Homebrew.
It's a command line tool to install software and libraries and it's pretty easy to use.
It's great that you are discovering the shell. You should read some tutorials for beginners. If you like it, you will learn very fast and in a few weeks, you will understand exactly why the command you tried didn't work. Have fun learning!
As Simon suggested you should install Xcode, however the CLI tools are not installed automatically. They must be downloaded through Xcode's, preferences. In Preferences click the Downloads tab then install next to Command Line Tools.
If any of the required tools are not automatically installed with Xcode, Homebrew is a great, easy to use, utility that can install nearly any UNIX or Linux command with the following syntax:
brew install <SomeAppName>
The Homebrew website has easy to follow instructions for setting it up initially. So if anything you need is missing try using that.
In Xcode 5, to download Command Line Tools, choose Open Developer Tool under "Xcode", then More Developer Tools> from the sub Menu. This takes you to an Apple web page - you'll need a Developer username/password to get to the Downloads page.
Choose the right CLT for your system, download and install from the dmg/pkg.

XCode 4.3 Command Line Tools Package with Invalid Checksum

The package Apple provides to install the command line tools with Xcode 4.3 is corrupted, and I seem to need it because I'm developing some command line tools.
Has anybody found an alternative Command Line package for Xcode 4.3 from Apple that works or an workaround for the subject?
Xcode includes a new "Downloads" preference pane to install optional components such as command line tools, and previous iOS Simulators.
So, I found a way to do this correctly.
The problem is really in one of the European mirrors from Apple.
The workaround is to:
- Install Tor: https://www.torproject.org/
- Choose a Tor node in the USA
- Logging into your Apple Developer account and download the package
It now opens correctly without any checksum warning.
I solved my own problem of downloading/installing Xcode 4.3.1 "Command Line Tools" by getting them directly from the developer's webpage. The March version yielded a checksum error just like
the download from within Xcode 4.3.1, i.e. Xcode/Preferences/Downloads . But I did have success with the February version of CLT. I don't know why things were out-of-sync.
I had the same problem when trying to install the Command Line Tools from the Downloads tab in the XCode preferences (also downloading from Europe). I fixed it by clearing the dns cache on my system.
This is the Terminal command to clear the dns cache (OSX Lion):
dscacheutil -flushcache
Restart XCode after running this command, it may not fix the problem with the checksum until you do.
try:
defaults write com.apple.frameworks.diskimages skip-verify -bool true
Just add another mirror for the download site:
Use the following to determine a valid ip:
http://www.webmaster-toolkit.com/dns-query.shtml?address=adcdownload.apple.com
and add this to /etc/hosts:
adcdownload.apple.com
Example (ip might already have changed)
64.211.144.168 adcdownload.apple.com.
You can simply click skip while the disk image is verifying. I have installed from a dmg of CLT-4.3 with this problem and built an extensive amount of software with if successfully on my te

How to install native assembler for Mac OSX?

I am interested to know how can I install native assemblar (I think also known as AS) on Mac OSX Lion. Someone suggested that I can use the Xcode to do it but I didn't see any options.Terminal windows is not able to recognize AS as command right now. Can someone provide more insight on this ? I am new to Mac/Unix environment so please provide help accordingly.
If you have Xcode installed, then you have as.There is no option to install specific packages from the Xcode installer.
as should be in /usr/bin/:
ls -l /usr/bin/as
If not, you probably have a problem with your Xcode installation.
Otherwise, also check your PATH environment variable, to ensure /usr/bin/ is in the list.
echo $PATH
If you've installed Xcode 4.3, it doesn't install the command line tools anymore. To get them, you have to launch Xcode, go to Xcode > Preferences... > Downloads tab, then click the 'Download' button for 'Command Line Tools'. You'll need to sign in with an Apple Developer ID.
Using Xcode 4.6 with Command Line Utilities installed
export PATH=/Applications/Xcode.app/Contents/Developer/usr/bin:$PATH
as will execute along with the other command line utilities.

Resources