iPhone SDK location on hard drive - iphone

I attempted to reinstall the iphone sdk on my mac. I figured the reinstallation would just override my previous installation but it seems that more hard drive space was eaten up after the second install. Does anyone know how I can refresh my installation and start from scratch to free up all the lost space?

Certainly at least as of Xcode 4.4, this has changed. It's now:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/
and
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/

It is also possible to get the path with the xcrun tool. In Terminal.app type the following:
xcrun --sdk iphoneos --show-sdk-path
and
xcrun --sdk iphonesimulator --show-sdk-path
This will have the following results:
$ xcrun --sdk iphoneos --show-sdk-path
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk
$ xcrun --sdk iphonesimulator --show-sdk-path
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk

There are SDK folders for each SDK version at:
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
and
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs

Related

xcrun: error: unable to find utility "xctest", not a developer tool or in PATH

I am using Xcode command line tools instead of XCode app in my MAC.
When i use swift --version
I get Apple Swift version 5.2.2 (swiftlang-1103.0.32.6 clang-1103.0.32.51)
I cloned a project with
git clone https://github.com/apple/example-package-dealer.git
cd example-package-dealer
swift run Dealer
I gives me this error:
error: terminated(72): OLDPWD=/Users/sayansen/Work/EdgeAnalytics/Trial TERM_PROGRAM=Apple_Terminal PWD=/Users/sayansen/Work/EdgeAnalytics/Trial/example-package-dealer SHLVL=1 SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.9lwBmlYTAx/Listeners HOME=/Users/sayansen LIBRARY_PATH=/usr/local/lib __CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0 XPC_SERVICE_NAME=0 TMPDIR=/var/folders/kn/v4zm474x52n8zrycxs7nh5c40000gn/T/ LOGNAME=sayansen SHELL=/bin/bash TERM_PROGRAM_VERSION=433 _=/usr/bin/swift PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Wireshark.app/Contents/MacOS CPATH=/usr/local/include SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk XPC_FLAGS=0x0 TERM=xterm-256color USER=sayansen LC_CTYPE=UTF-8 TERM_SESSION_ID=B285E686-2802-48C6-B8CE-03CA8F2314BF xcrun --sdk macosx --find xctest output:
xcrun: error: unable to find utility "xctest", not a developer tool or in PATH
I am not using XCODE.
I already did this:
sudo xcode-select -s /Library/Developer/CommandLineTools
But not helpfull.
How to solve this error without installing XCode?
Assuming you already have Xcode installed:
Start Xcode, select "Preferences -> Locations". Chances are that your Command Line Tools are not set. Select the suggested Xcode-tools location and you are done.
Additional:
You could check with:
xcode-select -p
which tools are set, mine showed:
/Library/Developer/CommandLineTools
After the location in the preferences was set, it showed:
/Applications/Xcode.app/Contents/Developer
(as it should)
Xcode -> Preferences (or command+,)
Locations tab -> Command Line tools section:
Select a tool there and you are done.
Just a wrong path, all the stuff still can be done w/o invoking GUI:
~/% sudo xcode-select -s /Library/Developer/CommandLineTools
~/% sudo xcode-select -p
/Library/Developer/CommandLineTools
~/% sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
~/% sudo xcode-select -p
/Applications/Xcode.app/Contents/Developer
The latest -s command fixes xcrun: error: unable to find utility "xctest" …

Compiling Freetype 2.6.5 Xcode for IOS

Alright guys, I posted a similar question and took it down because it wasn't specific enough so here I go. From the zip file of Freetype 2.6.5 I have not been able to create an Xcode project that will compile the library for iOS use, only for i386_64.
I tried the commands here but I don't get past the first commands the and I am getting this
FreeType build system -- automatic system detection
The following settings are used:
platform unix compiler cc
configuration directory ./builds/unix configuration rules
./builds/unix/unix.mk
If this does not correspond to your system or settings please remove
the file `config.mk' from this directory then read the INSTALL file
for help.
Otherwise, simply type
/Applications/Xcode.app/Contents/Developer/usr/bin/make' again to
build the library, or
/Applications/Xcode.app/Contents/Developer/usr/bin/make refdoc' to
build the API reference (this needs python >= 2.6).
cd builds/unix; \
./configure 'CFLAGS=-arch i386' /bin/sh: ./configure: No such file or directory make: *** [setup] Error 127
I also followed the instructions inside the cmakelists.txt that it comes inside the project but still nothing, I still get an xcode project for osx and not for IOS which is giving me a plethora of linking errors. Here is the instructions for your reference.
For an iOS static library, use
#
cmake -D IOS_PLATFORM=OS -G Xcode
#
or
#
cmake -D IOS_PLATFORM=SIMULATOR -G Xcode
I am not sure what else to do. Any help?
Here's an outline of the basic build process to compile the FreeType libaries for iOS:
Download the latest FreeType source code
Extract the archive and cd into the unarchived directory
Setup toolchain and export variables for the architectures desired (arm64, arm7, i386, x86_64)
Compile the source code and build the libraries
For example, the build commands for arm64 might look something like this:
$ export CC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
$ iphoneos="7.0" # target version of iOS
$ ARCH="arm64" # architecture (arm64, arm7, i386, x86_64)
$ export CFLAGS="-arch ${ARCH} -pipe -mdynamic-no-pic -Wno-trigraphs -fpascal-strings \
-O2 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden \
-miphoneos-version-min=$iphoneos -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/libxml2 \
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk"
$ export AR="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar"
$ export LDFLAGS="-arch ${ARCH} -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk \
-miphoneos-version-min=7.0"
$ ./configure --host="aarch64-apple-darwin" --enable-static=yes --enable-shared=no
$ make
$ clean
It's a bit of work to construct the commands for each arch, but
fortunately there's a build
script
— which automatically downloads, extracts, and builds the latest FreeType (2.6.5 currently).
To run the script just use the following command in Terminal:
./build_freetype.sh
The resulting iOS libraries can be found in ~/Desktop/FreeType_iOS_Release when it completes.

Use ant to create .ipa file

I want to clean, build and create .ipa file using an ant script. Also I need to set the application icon. I searched the web but couldn't find a solution. And i prefer to run the ant through the terminal.
Try searching for Ant + XCodeBuild. There should be plenty examples out there that give you a general idea how you can script an XCode build from ANT.
Key is the terminal xcodebuild command and you can only do this with Ant if you run your build on a Mac.
You can create a script.sh instead a Ant with this:
#!/bin/sh
cd {PROJECT_BUILDDIR}
xcodebuild -sdk iphoneos5.1 -configuration Release "ARCHS=armv6 armv7" clean build
/usr/bin/xcrun -sdk iphoneos PackageApplication -v "${PROJECT_BUILDDIR}/${PROJECT_NAME}.app" -o "${BUILD_HISTORY_DIR}/${APPLICATION_NAME}.ipa" --sign "${DEVELOPER_NAME}" --embed "${PROVISONING_PROFILE}"
And for start this, open Terminal and write:
sudo bash script.sh
This is is not tested, maybe exist a some small errors
For some tips

How to use gcc 4.2 with Xcode 4.2

I need to use gcc 4.2 with Xcode 4.2 for some older code. How do i get it to show
up. Xcode4.2 seems to have dropped support for it.
Thanks
Here is a way to enable compiling with gcc 4.2 in xcode 4.2. This is mostly done via command line so when you see lines starting with: [ 15:30 jon#MacBookPro / ]$, you need to open up Terminal.app and run the command that starts after the $.
No files or directories are removed or deleted in this process, so it is easy to undo if you need to compile with LLVM in the future.
Download - but do not install yet - xcode_4.1_for_lion.dmg or xcode_4.1_for_snow_leopard.dmg
Now, follow these steps to install Xcode 4.1 into /Developer-4.1:
Backup the working /Developer directory (where Xcode 4.2 is installed)
[ 15:30 jon#MacBookPro / ]$ sudo mv -v /Developer /Developer-4.2
Run the Xcode 4.1 installer using the default install location (/Developer)
Move the new Xcode 4.1 installation to /Developer-4.1:
[ 15:30 jon#MacBookPro / ]$ sudo mv -v /Developer /Developer-4.1
Move the Xcode 4.2 developer directory back to /Developer:
[ 15:30 jon#MacBookPro / ]$ sudo mv -v /Developer-4.2 /Developer
Edit the Xcode 4.2 GCC 4.2.xcspec file to get gcc 4.2 to show in the list of compiler options [1]:
[ 15:30 jon#MacBookPro / ]$ sudo vi "/Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/GCC 4.2 (Plausible Blocks).xcplugin/Contents/Resources/GCC 4.2.xcspec"
Change lines 41 and 42 from this:
ShowInCompilerSelectionPopup = NO;
IsNoLongerSupported = YES;
To This:
ShowInCompilerSelectionPopup = YES;
IsNoLongerSupported = NO;
Backup the Xcode 4.2 iOS/Simulator Framework usr directories:
[ 15:30 jon#MacBookPro / ]$ sudo mv -v /Developer/Platforms/iPhoneOS.platform/Developer/usr /Developer/Platforms/iPhoneOS.platform/Developer/usr.backup
[ 15:30 jon#MacBookPro / ]$ sudo mv -v /Developer/Platforms/iPhoneSimulator.platform/Developer/usr /Developer/Platforms/iPhoneSimulator.platform/Developer/usr.backup
Copy Xcode 4.1 iOS/Simulator Framework usr directories to Xcode 4.2:
[ 15:30 jon#MacBookPro / ]$ sudo cp -rv /Developer-4.1/Platforms/iPhoneOS.platform/Developer/usr /Developer/Platforms/iPhoneOS.platform/Developer/usr
[ 15:30 jon#MacBookPro / ]$ sudo cp -rv /Developer-4.1/usr /Developer/Platforms/iPhoneSimulator.platform/Developer/usr
Copy the gcc and info iOS SDK library directories from Xcode 4.1 to Xcode 4.2 [2]:
[ 15:30 jon#MacBookPro / ]$ sudo cp -rv /Developer-4.1/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/gcc /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/gcc
[ 15:30 jon#MacBookPro / ]$ sudo cp -rv /Developer-4.1/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/info /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/info
Compile using gcc-4.2!
This is a blog post I've written with a little more info about this process. Feel free to leave a comment on the blog if you run into any issues or have any questions.
[1] If opening from a command line (using something like vi, emacs, nano, etc) make sure to either enclose the path in quotes "/long path/with spaces/in it/file.xcspec" or escape the spaces /some/long\ path/with\ spaces/in\ it/file.xcspec
[2] This is necessary because the iPhoneOS.platform SDK has its own seperate /usr/lib directories but the iPhoneSimulator.platform SDK does not
So the full process for getting gcc 4.2 to work with a fresh install of Xcode 4.2 (non-iOS) is:
Install gcc 4.2
sudo port install apple-gcc42
Tweak Xcode so that gcc 4.2 appears as a compiler option, by editing the Xcode 4.2 GCC 4.2.xcspec file to get gcc 4.2 to show in the list of compiler options:
Open the xcspec file for editing:
sudo vi "/Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/GCC 4.2.xcplugin/Contents/Resources/GCC 4.2.xcspec"
Change lines 41 and 42 from this:
ShowInCompilerSelectionPopup = NO;
IsNoLongerSupported = YES;
To This:
ShowInCompilerSelectionPopup = YES;
IsNoLongerSupported = NO;
Link the gcc 4.2 binary to the location that Xcode expects:
sudo ln -s /opt/local/bin/gcc-apple-4.2 /Developer/usr/bin/gcc-4.2
sudo ln -s /opt/local/bin/g++-apple-4.2 /Developer/usr/bin/g++-4.2
I explained the problem and workaround in this blog post, which condenses the information I found. Feel free to comment.
Thanks chown for sharing this! I struggled around half a day, but at the end it turned out, that I only needed a few steps to achieve my goal:
For everyone that just needs GCC-4.2 to compile apps (no iOS stuff) it's pretty easy:
You don't need to install anything just follow these few steps:
EDIT: If you don't have GCC 4.2 installed already (from an earlier version of Xcode, or manual install), follow the instruciotns from Sean DeNigris in the comments!
Follow step 3 from the original description:
Edit the Xcode 4.2 GCC 4.2.xcspec file to get gcc 4.2 to show in the list of compiler options.
Make Xcode find the compiler again:
ln -s /usr/bin/gcc-4.2 /Developer/usr/bin/gcc-4.2
Also make the linker available:
ln -s /usr/bin/g++-4.2 /Developer/usr/bin/g++-4.2
This works perfectly for me! But as I said it's just for non iOS products!
Simple and userful solution https://github.com/kennethreitz/osx-gcc-installer/
It automates the lists of the declaration on the stackoverflow

How do we create a 32-bit build of Perl 5.12.3 in /usr/local on Mac OS X Snow Leopard?

For one reason or another we need to create a custom 32-bit build of Perl 5.12.3 in /usr/local on Mac OS X Snow Leopard.
Can anyone explain the process or point us the direction of a tutorial or example?
On Snowleopard the kernel runs in 32bit mode and the userland mostly in 64bit mode. The kernel is able to run 32bit and 64bit userland apps without a problem.
You need to tell the perl build system to create a 32bit only binary. This is done by setting the -arch gcc flag.
For a simple singe file app you would do it like this:
gcc -arch i386 -o app app.m -lobjc -framework CoreFoundation -framework Cocoa
In your case you have to pass the arch flag to the build system.
Iam not a perl expert but i would configure perl like this:
./Configure -Dprefix=/usr/local -A ccflags="-arch i386"
If your system doesn't have 64bit kernel extensions turned on, then you should just be able to build Perl straight from source and pass DESTDIR=/usr/local on the make install command line. If the system is in 64bit mode, you'll need to look up how to cross-compile for i386, which isn't something I've had to do before as I just build perl for my native architecture, or install from a package.
Here's how I did it using Perlbrew:
Install Perlbrew
Make sure you have followed all of the proper steps including adding the bit to the end of .bash_profile.
Run the following (for perl 5.14.2, with threading. Adjust as necessary for other perl versions and options) (Thanks to WildPerl for this bit of wisdom):
perlbrew install 5.14.2 -ders -Dusethreads -Duseithreads -Accflags="-arch i386" -Accflags="-B/Developer/SDKs/MacOSX10.6.sdk/usr/include/gcc" -Accflags="-B/Developer/SDKs/MacOSX10.6.sdk/usr/lib/gcc" -Accflags="-isystem/Developer/SDKs/MacOSX10.6.sdk/usr/include" -Accflags="-F/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks" -Accflags="-mmacosx-version-min=10.5" -Aldflags="-arch i386 -Wl,-search_paths_first" -Aldflags="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk" -Aldflags="-mmacosx-version-min=10.5" -Alddlflags="-arch i386 -Wl,-search_paths_first" -Alddlflags="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk" -Alddlflags="-mmacosx-version-min=10.5" -Duseshrplib
If you have a newer version of Xcode with the Developer SDKs as part of the app bundle, you'll need to create a symlink to them from /Developer:
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/ /Developer
Install the local copy of cpanm:
perlbrew install-cpanm
After that finishes, go to the place where perlbrew installed perl (on my system that is: ~/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2/darwin-thread-multi-2level/ and edit Config.pm to change this line:
cc => 'cc',
to this:
cc => 'cc -m32',