Is there a way to silently accept the xcode license? - xcode

I'm trying to automate the installation of git for a large scale deployment on osx, and right now we're relying on the xcode tools version of git. As of OSX Mojave, it now requires the user to accept the xcode license before you can install, which has been breaking all our install scripts. Is there a way to automate the acceptance of this license?

Yes, you can use xcodebuild -license accept as root (or with sudo). You may want to use xcodebuild -runFirstLaunch instead, which will also install the needed package (you don't need that for git, but it may simplify the rest of your process).

Related

If I install Homebrew on Max OSX, am I required to use XCode as my IDE?

I'm a new developer, learning to set up environments both local and cloud-based. For local, I already have installed Node and Git and they are working. And I use Visual Studio Code for editing files, for terminal, also for managing Git repo.
I've heard good things about Homebrew and I'd like to try it, but on its installation instructions, it lists the following among its MacOS requirements: "Command Line Tools (CLT) for Xcode: xcode-select --install, developer.apple.com/downloads or Xcode 3"
Does this mean I would be required to use Xcode every time I interact with Homebrew? Nothing against Xcode but I'd be surprised if Homebrew can't be used just as easily with some other IDE like VSCode or Sublime text, etc. Thanks.
What you need are the Xcode command line tools and not the IDE itself, they can be downloaded separately so you don’t have to install the full Xcode app.
So while Homebrew does make use of those command line tools it isn’t something you will notice when using homebrew.

Flipper cannot be opened because the developer cannot be verified in macOS Catalina

Flipper is a platform for debugging iOS, Android and React Native apps.
I have downloaded the Flipper app from https://fbflipper.com/, but I can't run it.
macOS version: Catalina 10.15.3
Just Right Click > Open. Or alternatively, open System Preferences, Security & Privacy, General tab, and Click 'Open Anyway'. Guide on support.apple.com
Still not working?: Right Click > Open, again. If you don't have certain permissions on your mac (for example on your work laptop), you'd need to run xattr -d com.apple.quarantine /Applications/Flipper.app instead.
Problem
This is a general problem (security feature called Gatekeeper) with apps on macOS where the developer is not registered with Apple (Paying $99/year) and so has not notarized their application. Specifically, Gatekeeper saves a quarantine flag on a downloaded file. So alternatively, you can remove this flag for your specific file, or disable Gatekeeper entirely so you never have this issue again.
A nice explanation by the Terraform team who faced the same issue:
Indeed the new version of MacOS is stricter about running software you've downloaded that isn't signed with an Apple developer key. Terraform distributions are signed with a HashiCorp key with signatures distributed out of band on releases.hashicorp.com, but MacOS Catalina is requiring participation in Apple's developer program specifically, and Terraform is currently not built to support that. source
From an app developer stand point: Applications on macOS need a Developer ID certificate to verify that we are trusted developers. This also provides access to macOS capabilities: e.g. CloudKit, Apple Push Notifications. If you're making an app, you can need to go into developer.apple.com to create an Apple Developer ID certificate, or create on in XCode (in some cases).
You can run following command to remove the warning and allow un-authorized app to run on macOS Catalina:
xattr -d com.apple.quarantine /Applications/Flipper.app
Go to System preference, Security and Privacy and choose Opneanyway:
An alternative is to either run or build from source.
Helpful if you're on a work computer with tighter application security settings.
Prerequisites:
NodeJS (https://nodejs.org/en/)
Yarn (https://yarnpkg.com)
Running from source
git clone https://github.com/facebook/flipper.git
cd flipper/desktop
yarn
yarn start
Building from source
yarn build --mac --version $buildNumber
For Building from source, you should do it in the following steps:
git clone https://github.com/facebook/flipper.git
cd flipper/desktop
yarn
yarn build --mac --version $buildNumber
Note: I've noticed building from source as of Aug 2020 0.53.0 has some issues for me, so would recommend running from source if you need to use this.
brew install --cask flipper
and after that you'll see message 'flipper was blocked from ... '
press Open Anyway

How to accept Xcode license?

I've been searching the web to look for how to accept Xcode in order to use Xcode to recompile a MATLAB Windows file for a MAC but I did not find any relevant answer.
The error message I get in MATLAB is :
Xcode is installed, but its license has not been accepted. Run Xcode
and accept its license agreement.
I have accept its license through the terminal command sudo xcodebuild -license then -q then agree but I still get the same error message. I have also accepted the license when first opening the application.
Do someone know how to solve this problem?
Xcode : version 6.4 and Matlab R2015a
You can use the following command to directly accept the license:
sudo xcodebuild -license accept
If you are using the command line then go through the entire license by entering space until you get to the end where you will be presented with:
By typing 'agree' you are agreeing to the terms of the software license agreements. Type 'print' to print them or anything else to cancel, [agree, print, cancel]
type "agree" and return
Alternatively just launch Xcode by double clicking it's icon and when presented with the license agreement accept it.
Updated for new information:
It seems this may be a MATLAB issue. What version of Xcode are you running? Check with MATLAB to see if that is a supported version.
Simply type the sudo xcodebuild -license into the terminal after press q for quite
then type agree
Note: Xcode name should be Xocde not like that Xcode 8.2,etc.,
If you have only the Command Line Tools installed (and you don't want the full Xcode), none of the above works. From my saver here, run the following to trick mex into seeing an accepted license (no sudo needed).
Here I use the current version 13.0 at the time of writing, to be adapted.
defaults write com.apple.dt.Xcode IDEXcodeVersionForAgreedToGMLicense 13.0
You can also try enabling the command line tools, which should help prevent the license acceptance issue:
# Install Command Line Tools
xcode-select --install
# Enable command line tools
sudo xcode-select --switch /Library/Developer/CommandLineTools
Source: https://github.com/nodejs/node-gyp/issues/569
What worked for me was deleting the file: Library/Preferences/com.apple.dt.Xcode.plist and then running 'sudo xcodebuild -license accept' in the terminal.
The first Xcode Licence I agreed to was a beta license. Therefore somehow the entries in this file were still named ...beta... what seems to have caused the error. By running 'sudo xcodebuild -license accept' a new file is created that is compatible with Matlab (provided ur not using a beta Xcode Version).
I also downloaded the latest Version of the Command Line Tools but I don't know if that would have been necessary.
Hope I could help.
This is from 2021, using Mac Big Sur version 11.0.1 with Xcode-beta
My problem is that Macports install requires Agree to Xcode license in Terminal: sudo xcodebuild -license but that command returned only xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance.
I found a stack overflow issue that mentioned how to reset the xcode-select.
which in my case is sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer. Then I used sudo xcodebuild -license, scrolled through the license and accepted it. (Via the application, I never had an option to accept.)
the other stack flow issue that helped me is xcode-select active developer directory error
FYI - If you have installed the beta version at some point, deleted it, and then installed the regular version of Xcode, the license file will still be associated with beta version. This is what was happening to me, as I continued to get the warning about not having accepted the license. To fix this issue, you need to delete the Xcode license file and then run the above command in terminal.
Navigate to /Library/Preferences/
Delete the file com.app.dt.Xcode.plist
Then in terminal sudo xcodebuild -license accept
Then in Matlab mex -setup
This worked for me! Note that this method of deleting the plist file was provided to me by the folks at Mathworks support. There had been existing issues related to beta installs of Xcode.

Is it possible to use MacPorts with ONLY Xcode 4.3 CLI tools installed?

I understand that starting with Xcode 4.3 the CLI tools are a separate installation and that caused many issues with existing MacPorts installations upon upgrade. This question is not about that problem. With a brand new rMBP 15.4", I attempted to install only the CLI tools via download from the Apple Developer site. Not only did MacPorts fail to find Xcode, but xcodebuilder itself failed to execute (simply hangs...). I tried many iterations of using xcode-select to point to the CLI binaries, but I couldn't get either MacPorts or just the CLI binaries to work.
Is it simply not possible to only install (the wonderfully tidy and SSD-friendly) CLI tools and get MacPorts to work? I was not able to find anybody that specifically confirmed or denied this in several searches here and on Google in general. With a 128GB SSD, every GB counts... and the 4+GB Xcode install (99% of which I don't need) is a waste of space. Is there something in the proper Xcode install that MacPorts requires?

Jenkins: How to configure Mercurial installer for OSX?

How do I configure Jenkins to automatically install Mercurial on nodes (slaves) that need it?
I tried checking the Mercurial -> Install Automatically combo-box under the Master node but it didn't seem to work. Do I need to "Add installer" for this to work? If so, how?
Apparently there are many Jenkins bugs on OSX: https://groups.google.com/d/topic/jenkinsci-users/J5FzjoCLxaE/discussion
There doesn't seem to be a way to auto-install Mercurial under OSX at this time. You must install Mercurial manually and point Jenkins to it. Ubuntu deployments can run sudo apt-get install mercurial but I'm not familiar with an equivalent for OSX.

Resources