"Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo." when using GCC - ios

While attempting to compile my C program, running the following command:
gcc pthread.c -o pthread
Returns:
Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
and my code does not compile.
Why is this happening and how can I fix this problem?

Open up Xcode, and accept the new user agreement. This was happening because a new version of Xcode was downloaded and the new agreement was not accepted.

sudo xcodebuild -license
will take care of it with no trouble on the command line. Note that you'll have to manually scroll through the license, and agree to its terms at the end, unless you add "accept" to the command line :
sudo xcodebuild -license accept

Got stuck as I was trying to a go get ... I think it was related to git.
Here is how was able to fix it ...
I entered the following in terminal:
sudo xcodebuild -license
This will open the agreement. Go all the way to end and type "agree".
That takes care of go get issues.
It was quite interesting how unrelated things were.

Opening XCode and accepting the license fixes the issue.

You don't need to fiddle around with any command :)
Once the XCode is updated, open the Xcode IDE program. Please accept terms and conditions.
You are all set to go :))

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
A new version of OSX or XCode was installed and Apple wants you to agree to their Terms and Conditions. So just launch Xcode and "Agree" to them.

I had the same issue, after accepting the license launching XCode or running sudo xcodebuild -license accept i had to restart my Mac – otherwise it did not worked.

Follow these steps:
Open Terminal.
Enter this command: sudo xcodebuild --license.
Enter system password.
Agree to the license.

I had the same issue when I tried to use git.
It is possible to install git without it. And I doubt that gcc on mac is truly dependent on XCode. And I don't want to use root to accept something unless I'm sure I need it.
I uninstalled XCode by navigating to the applications folder and dragging XCode to the trash.
Now my git commands work as usual. I'll re-install XCode if/when I truly need it.

I'm facing the same issue.
The issue because of X-Code.
Solution:
1. Open X-code and accept user agreement (T&C).
or
2. Restart your MAC, It will resolve automatically.

If you have similar issues in Intellij do as others said above me :
Open Terminal.
Enter this command: sudo xcodebuild --license.
Enter system password.
Go to the end of file: Press space(button) to do that.
Type 'Agree' to the license.
And you are done.!!

Related

Xcode build rules script "command not found" on M1

I have a project that runs some utility I've installed using homebrew on one of its build rules.
On my M1 mac, homebrew is installed on /opt/homebrew/bin.
I have eval "$(/opt/homebrew/bin/brew shellenv)" present in my ~/.zprofile file, but it seems like Xcode doesn't respect that (or maybe overrides it?).
When trying to evaluate the PATH variable during Xcode run script command I get the following:
PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/libexec:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/usr/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/usr/local/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/local/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
For clearance, this is the phase I was running, under Build rules.
I've managed to find two workarounds that work with this issue, the first is to symlink the program you want from /opt/homebrew/bin onto /usr/local/bin (protoc in my case)
sudo ln -s /opt/homebrew/bin/protoc /usr/local/bin/protoc
The second is to add the following line to the build rule script:
eval "$(/opt/homebrew/bin/brew shellenv)"
This has the disadvantage of not working on non M1 Macs.
There is a possible, very simple solution provided by this answer.
Basically, freshly upgraded versions of XCode (for example, 13.4.1) running on Apple Silicon-powered Macs (like my M1 MacBook Pro), have components that cannot properly use/output the appropriate object files in all the output platform combinations you need.
This leads to some "interesting" issues and error message cross-overs that find "almost correct" answers on StackOverflow. Hence the many suggestions to exclude "arm64" platform and similar from the build options.
The simple answer to all of that is... to just run XCode with Rosetta enabled. Rosetta will engage with the components that miss the needed cross-platform capabilities.
Here is an example of how to enable an application to use Rosetta. You select the app icon, then go to the File menu and select "Get Info". Then click the "Open using Rosetta" checkbox.

Fastlane Apple Generic versioning not enabled in this project

What I’m doing is trying to make bitbucket pipline do my iOS CD, I included docker fastlanetools/fastlane image and in the steps i pull and run the docker image everything is okay and i was able to let fastlane command work by calling fastlane beta in the steps.
What’s happening is that fastlane exits with the error
Apple Generic versioning is not enabled in this project.
I followed apple documentation to enable it from xCode
from here
I changed all the targets in my project to use App Generic and still not working
In case it was this issue xcrun avgtool xcrun: error: unable to find utility "avgtool", not a developer tool or in PATH
after
sudo xcode-select -s /Applications/Xcode.app
fastlane stopped complaining
In my case it was the issue of Command Line Tools, which wasn't specified under the location tab.
Add your xcodeproj path.
Like
increment_build_number(
xcodeproj: '../XXX.xcodeproj',
build_number: number
)
I met the same problem. I searched and tried a lot of ways, but still not worked it out. A flash of inspiration came to my mind. I set a certain version via increment_version_number, it was succeeded magically. Then I tried increment_version_number again to make it automatically increment the version number. Lucky me, it worked.
I had two installations of macOS but Xcode only on one of them, after updating I lost the command line tools location. After setting that up in the preferences it worked again
What i missed was missed setting CURRENT_PROJECT_VERSION
(whz. Current Project Version) build setting, which specifies the current version of your project.
Reason:
By default, Xcode does not use any versioning system & no value for Current Project Version. So setting versioning system to Apple Generic ensures that Xcode will include all agvtool-generated version information in your project.
Reference
So make sure, your below set values for
I highly recommend using this plugin if your issue is not having argvtool accessible in CI/CD when trying to bump stuff uniformly for both IOS/Android before it does it in the macOS runner or action etc
In my case this problem appeared after I updated Xcode and my xcode-select was pointing to the missing folder.
After I executed xcode-select -s /Applications/Xcode_13_4.app Fastlane continued working as it used to before.

React Native - launchPackager.command cant be opened

I am having trouble building react native ios project.
Error message:
"launchPackage command" can't be opened because it is from an unidentified developer.
Any idea how to fix this?
Although this answer will most likely work, you would also allow all future apps from unidentified developers to be installed without being prompted.
To allow executing only the command in question (launchPackager.command), go to your react-native installation folder (most likely node_modules/react-native/scripts) in Finder and right-click launchPackager.command, choose Open and confirm by clicking Open again.
You will not be prompted again for this command as you have allowed execution specifically.
Another simple way is to delete node_modules folder from project directory and do npm install.
This happened because project was copied from old mac which had node_modules folder created by that old mac user, hence some problem occurs for project transferred to new mac.
Had the same problem on macOS Mojave.
This helped:
chmod 777 node_modules/react-native/scripts/launchPackager.command
on MacOS Catalina and above
Go to
System Preferences
Security & Privacy
Choose tab "Privacy"
Select "Developer Tools" on left pane
Check "Terminal" to allow terminal to run software locally which does not meet system's security policy . (please be aware of potential implications of this action and make sure that you know what you are doing )
Go to
System Preferences
Security & Privacy
Choose tab General
Choose Allow apps downloaded from anywhere or Allow apps downloaded from App Store and identified developers
I had the same error with you and this method worked for me.
chmod 777 node_modules/react-native/scripts/launchPackager.command
open terminal and Run the above command
after that Run the react-native run-android
Works for Me, It will Run :)
The reason is because you downloaded source code using virtual machine.
Solution:
Please download source code at your real machine.
And then copy it at VM, and build this project.

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)

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

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.)

Resources