How can I update only Xcode from a shell script? - xcode

man softwareupdate says --list will "List all available updates." but it does not list Xcode. Manually opening the App Store shows an Xcode update.
How can I update only Xcode from within a script without updating the entire system and macOS itself (by running softwareupdate --install --all)?
Perhaps mas-cli can do it, but the preferred method to install chokes on the problem I would be using it to solve:
$ brew install mas
Error: Your Xcode (7.2) is too outdated.
Please update to Xcode 8.3 (or delete it).
Xcode can be updated from the App Store.

Related

Can't Open .xip Xcode File

I'm trying to install XCode 10.2 (most recent) through the developer.apple.com download. After downloading the .xip file, I try to open it like many other people have suggested, but it just creates a XCode_10.2.xip.cpgz file. I click on that and it creates an XCode_10. 2 2.xip and the cycle continues.
Because of billing issues, I can't use the app store to download XCode.
You can install upgrades from the terminal without going to app store. If your running Mojave then Xcode 10.2 will run on your machine. If not, then Xcode 10.1 is latest version.
Go to the terminal and type sudo softwareupdate -i -a and press Enter. This will download all application upgrades for your computer; not just Xcode.
Again, don't attempt to upgrade XCode unless you are running Mojave 10.14

XCode prerequisite version check failed? Unable to package app with Intune Packager

Edit: It appears the latest Release Notes from Apple indicate massive changes with the build system. Currently, Intune's Package Manager hasn't been recently updated, so I don't expect a fix besides downgrading until update.
I just updated XCode and OSX and ran the Intune MAM packager as always, but now instead of succeeding, I get this:
Version of MACOSX is 10.13.5
XCode prerequisite version check failed: failure in executing the xcodebuild command.
Missing prerequisite.
Cause of the error to be provided for investigation:Error Domain=IntuneAppPackager Code=22 "XCode version 5 or greater is required to run this tool." UserInfo={NSLocalizedDescription=XCode version 5 or greater is required to run this tool.}
I already had to re-enable certs to match the profile, but this seems unrelated. I have the latest XCode and the build tools installed via default settings. I googled different parts of this error and nothing came back. This could be InTune's mam packager but the error itself is relatively specific in saying XCode Build tools.
Try this code in your terminal:
xcode-select -p, then check if that path is correct path of your Xcode.
If this doesn't work, try this code:
sudo xcode-select --switch /correct path of the xcode app.
For example:
sudo xcode-select --switch /Applications/Xcode_7.3.1.app/Contents/Developer
This is what I did, and it works!
I have Xcode installed via App Store and came across the same error after switching to a new version of Intune MAM Packager.
sudo xcode-select --switch /Applications/Xcode_7.3.1.app/Contents/Developer
That worked for me

Homebrew says Xcode is out of date but it doesn't show up in the App Store

When trying to install a homebrew keg, I get the following error:
$ brew install direnv
Error: Your Xcode (8.0) is too outdated.
Please update to Xcode 9.1 (or delete it).
Xcode can be updated from the App Store.
When I open the app store, Xcode doesn't indicate any software update is available – in fact, it even doesn't appear to be installed.
How can I update (or delete) it?
If /Applications/Xcode.app exists, but it's not showing up in the App Store as installed, then it's likely you installed Xcode manually by downloading it from Apple Developer Downloads.
You can delete it simply by moving /Applications/Xcode.app to the trash. This should allow you to brew install <package> without the error.

Xcode installing on mac

I am new to mac and I want to install Xcode. I have macOS Sierra Version 10.12.2. I found online that I have to run in terminal:
xcode-select --install
I did that but I get this:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
However, I can't find it in Application folder or with Spotlight Search and there is no Software Update to be done. Also, I found online that I have to download it from App Store and I am a bit confused. I can install it from terminal (and if so, why is it not working) or I have to download it from App Store?
Thank you!
xcode-select: error: command line tools are already installed, use
"Software Update" to install updates
It shows that your operating system has already installed xcode-select.
Finding your xcode-select. Go to Terminal and type
xcode-select --print-path
It shall return the location of your xcode-select to you:
/Library/Developer/CommandLineTools
Xcode: develop an app for Apple products
xcode-select: command-line tool
Depending on what you want to do with Xcode, xcode-select is way smaller than it, 8.1GB vs. nothing.
2018 and I had the same issue. Installing XCODE from the App Store did not resolve this.
I Had to download the command line tools for my XCODE and Apple Version.
https://developer.apple.com/download/more/
Searched for XCODE on that page above and picked the right version for me.
After installation of the DMG I could continue with Brew Installation.
You don't install Xcode from terminal, you have to go to develloper.apple.com in order to download the latest versions. Here's the link to save you some time:
Link to Xcode
Plus the version available depends on what Mac Osx version you have.
Was having the same issue after some system update, cannot even run things like make install.
verify your path by xcode-select --print-path, which might be /Applications/Xcode.app/Contents/Developer(need to be updated at last)
go to apple develper site, login, search command line tools, download the latest dmg, install. (better option than the 10+GB Xcode)
now update the path in step 1 by running sudo xcode-select --switch /Library/Developer/CommandLineTools.
verify again by running the xcode-select --print-path.
Now it should be good to go.

How do you update Xcode on OSX to the latest version?

What is the easiest way to update Xcode on OSX?
I see this in the terminal:
$ brew install xxxxxxx
Warning: Your Xcode (4.3.3) is outdated
Please install Xcode 4.6.
But when I go to open up Xcode > Preferences > Downloads, it says there are no updates?
Open up App Store
Look in the top right for the updates section (may also be in lefthand column "Updates"..)
Find Xcode & click Update
softwareupdate --list see the list of outdated software.
softwareupdate --install --all update all outdated software.
softwareupdate --install <product name> update the software you named.
Sometime I don't see the Xcode update in Updates tab in AppStore
So I search Xcode in AppStore
Then click update and it update
If attempting to download via the App Store leaves you with a little grey spinner and nothing actually happening, then you can go to :
https://developer.apple.com/download/more/
log in with your Apple Developer ID, and the latest Xcode should be available as a .zip download.
In my case (Xcode 6.1, iOS 8.2) I did not see the update in AppStore.
I found Xcode 6.2 for download and pressed "Install".
Then, it installed and asked for the update (more than 2 Gb).
Xcode 6.2 works correctly with iOS 8.2 and iOS 8.1.2
Hopefully this tip will help somebody else...
xcode-select --install worked for me
Another best way to update and upgrade OSX development tools using command line is as follows:
Open terminal on OSX and type below commands. Try 'sudo' as prefix if you don't have admin privileges.
brew update
and for upgrading outdated tools and libraries use below command
brew upgrade
These will update all packages like node, rethinkDB and much more.
Also, softwareupdate --install --all this command also work best.
Important: Remove all outdated packages and free some space using the simple command.
brew cleanup
If you want the latest Beta, it will not be in the AppStore. Instead you have to login to https://developer.apple.com and download from there.
In my case I solved this "no updates" issue by accessing AppStore from the developers link:
https://developer.apple.com/download/release/
Apart, you might find this command useful: mas-cli-github
$ brew install mas
$ mas list
$ mas search Xcode
$ mas install <id>
$ mas upgrade <id>
I ran into this bugger too.
I was running an older version of Xcode (not compatible with ios 9.2) so I needed to update.
I spent hours on this and was constantly getting spinning wheel of death in the app store. Nothing worked. I tried CLI softwareupdate, updating OSX, everything.
I ultimately had to download AppZapper, then nuked XCode.
I went into the app store to download and it still didn't work. Then I rebooted.
And from here I could finally upgrade to a fresh version of xcode.
WARNING: AppZapper can delete all your data around Xcode as well, so be prepared to start from scratch on your profiles, keys, etc. Also per the other notes here, of course be ready for a 3-5 hour long downloading expedition...
You DO NOT need to upgrade Xcode.
Just open the file /usr/local/Homebrew/Library/Homebrew/extend/os/mac/diagnostic.rb ,
then remove this line check_xcode_minimum_version in the following function.
def fatal_build_from_source_checks
%w[
check_xcode_license_approved
check_xcode_minimum_version //<-- this one
check_clt_minimum_version
check_if_xcode_needs_clt_installed
].freeze
end
Then brew install should works fine.
I used the Command_Line_Tools_OS_X_10.XX_for_Xcode_7.2.dmg and therefore had to download the latest version from here.
Check https://xcodereleases.com/ where you can also download legacy versions.
For me it was >41GB for the update to start. ~/Library contains a lot of cached content for mail, browsers, etc...you can safely remove those. Remove big apps too, like iMovie..you can always install it back later

Resources