Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between MACOSX_DEPLOYMENT_TARGET and -mmacosx-version-min?

I often need to target Mac OS X versions that are older than the one I'm currently running. As I prefer to work with a bash shell and Makefiles, I do not use Xcode. Apple explicitly supports targeting older OS X versions, but I've always been confused by the redundancy of the two configuration steps that are usually taken to target older platforms:

  1. gcc is started using --macosx-version-min:

    gcc --mmacosx-version-min=10.6 .... 
  2. The MACOSX_DEPLOYMENT_TARGET environment variable is set to the desired platform, e.g.

    export MACOSX_DEPLOYMENT_TARGET=10.6 

When trying to figure out the actual difference between the two by searching, you'll come up with different answers. Some people say that they do exactly the same, so it's only necessary to use one of the two. However, there are also voices which say that it's necessary to do both: start gcc with --macosx-version-min and set the environment variable.

Are these two things exactly the same? Is it only necessary to use one of the two but not both? Is there some official documentation available somewhere? Apple mentions MACOSX_DEPLOYMENT_TARGET but doesn't mention --macosx-version-min at all, even though it seems to be much more common.

like image 772
Andreas Avatar asked Aug 17 '14 18:08

Andreas


People also ask

What is Macosx_deployment_target?

MACOSX_DEPLOYMENT_TARGET. This is a CMake Environment Variable. Its initial value is taken from the calling process environment. Specify the minimum version of macOS on which the target binaries are to be deployed.

What is iOS development target in Xcode?

That is the iOS deployment target or the minimum deployment target for iOS. It means that the application runs on any iOS device with iOS 14.3 or later installed. The values the dropdown menu lists depend on the version of Xcode you are using. Xcode 12, for example, no longer supports iOS 8.

How do I change the deployment target on Mac?

Deployment Target refers to the oldest version of iOS that is capable of running your project. To change your deployment target, open up your project file in Xcode and check the setting under Build Settings -> Deployment(...) Check this answer to add earlier devices support.

How do I change the minimum deployment target in Xcode iOS?

Simply make a manual update to the Development target in the Xcode Pods file. It is your pod files deployment target iOS Version, not your project deployment target iOS Version, that is causing the issue; thus, you must update the deployment iOS version for your pods to anything more significant than 8.0 as well.


1 Answers

The man pages of gcc on Mac OS X say that they're synonymous:

-mmacosx-version-min=version The earliest version of MacOS X that this executable will run on is version.  Typical values of version include 10.1, 10.2, and 10.3.9.  This value can also be set with the MACOSX_DEPLOYMENT_TARGET environment variable.  If both the command-line option is specified and the environment variable is set, the command-line option will take precedence. 
like image 119
Andreas Avatar answered Sep 19 '22 17:09

Andreas