What's the standard way to set up a dev environment on a Mac? - xcode

I've just done a clean install of XCode 3.2.6 on Snow Leopard, to the default /Developer dir.
Is the right/normal way that all libs, and software tools such as CMake/git should be installed inside /Developer too? Is it comparable with how Linux expects standard dirs to be used for things, or more like Windows where it's all down to personal preference?
Any good guide for a experienced developer who's a noob to Mac dev is appreciated. For instance I'm confused where and how my SVN client came from and why I have SVN but not Git.

In general, you should not install anything inside of /Developer (not /Development). You should assume that anything under it is managed by Apple via Xcode packages. For additional command line tools and libraries, one standard Unix-y practice is to install them in /usr/local which is provided for such purposes. (Do not install anything in any other /usr locations as they are also managed by Apple.) But, rather than building and installing a lot of third-party software - like git - yourself or using binary installers from different providers which may not play well together, it is a good idea to use one of the open-source package managers for OS X. The most widely used are Homebrew, MacPorts, and Fink. Pick one and stick to it.
In Xcode 3, Apple shipped svn but not git. That changes in Xcode 4, the default on 10.7 Lion, which does include git. And, as of Xcode 4.3, there no longer is a /Developer directory as Xcode itself is now an app in /Applications and the items formerly in /Developer are included within its app bundle.

Related

Uninstall xcode but keep other dependencies

I do not work on iOS or OSX apps, but I do a fair amount of other development. Therefore, I need to keep things like python, gcc, etc. How can I uninstall the xcode app without removing these other things?
How can I uninstall the xcode app without removing these other things?
First point to note is that python comes pre-installed on your mac and can be interacted with independently of Xcode.
You delete the Xcode application from your applications folder (/Applications) and leave the developer tools in place. This would leave the command line tools in place, you could call this a bit of a hack.
location of command line tools:
/Library/Developer/CommandLineTools/usr/bin/
Completely remove Xcode and command line tools and use a package manager tool like HomeBrew to install the tools you require.

Redistributing Tools used by application (OSX, imageMagick, TWAIN - SANE)

I have a mac application that uses twain (Relies on 3 packages that I had to install: libusb, sane backends, and twain sane interface) and imagemagick which I also used a package to install and I'm not really sure how to go about redistributing them.
I'm thinking I would have to include the source for each package I rely on, libusb-1.0.9.tar.bz2 for example for the lib usb package, and then configure and make each of those in /use/local/bin (Basing that off seeing it done by the binary packages). I imagine I would have to add these locations to $PATH once done.
I was trying this myself but ran into this error: "configure: error: no acceptable C compiler found in $PATH" so am now downloading xcode developer tools. I imagine the end user for my installer will run into this issue as well though if they don't have it installed so I'm now not sure how to proceed.
Can anyone shed some light on how to properly distribute tools that your app relies on? I am using FileStorm Pro and was planning on using applescript shell commands to do the command line work.
Unless you were planning to distribute your application as source, you definitely don't want to distribute its dependencies as source. Most Mac users do not have the Xcode developer tools, and do not want them.
Build the binaries on your machine (ideally on a clean machine with the oldest version of OS X you want to support, the newest version of Xcode that works on that OS, and nothing else installed on it). Then copy the resulting binaries somewhere into your .app bundle. Then, instead of running the tools in a way that relies on $PATH, launch them by an explicit path relative to argv[0] or [NSBundle mainBundle].
(And make sure to check the licenses of every third-party tool you're using.)

Upgrading to Mac OS Lion as Developer

I'm planning to buy Mac OS Lion, but I would like to know some informations.
- Are Snow Leopard's apps compatible with Lion?
- Are apps compiled with Xcode for Lion compatible with Snow Leopard? What if these app uses popovers/fullscreen which are features of Lion?
xCode requires a full download (the full 5*ish GB) and if you are a Java guy you will have to re download Java as it is not included (this was my experience when opening eclipse for the first time in Lion).
Some of Snow leopards apps are compatible, not all (ppc apps will not work). It is probably best to check with the software vendor first.
Another thing your Library folder disappears on an upgrade among some others where Lion is trying to 'Protect' its users. To get round this simply enter the command into terminal. (replace username with your username and foldertoreveal with the hidden foldername)
chflags nohidden /Users/Username/FolderToReveal
The upgrade process other wise has been fine. For reference I am an Obj C /C++ /C and Java developer. Hope this helps
Also will link you to this post about Developing Java on Lion:
Stack Overflow post on Java in Lion
A very good list of compatible applications is available at RoaringApps. I highly recommend checking for your favorite editors/IDEs/etc there.
Of note:
TextMate: "Works fine," but there are some issues
BBEdit: "Works fine"
iTerm2: "Works fine" (minor interface bugs)
And of course, Apple's tools require an upgrade to XCode 4.1.
As far as developing with the new APIs in Lion, you can explicitly target a specific version of OS X for compatibility. When building for 10.6, those new APIs will not be exposed during compilation and you will get warnings about unrecognized selectors if you try to use them.
So far what I've noticed :
- make sure you install XCode 4.1 (not the same as 4.0, it's a free separate download), which fixes the Python includes mess
- go to terminal and type "java", this will trigger the download of the Java runtime
But I chose to avoid the burden of fixing all libs by going with a clean install of Lion (from a USB key)
cvs stopped working for me, but downloading Xcode seemed like an unnecessarily heavyweight fix. Adding /Developer/usr/bin to my PATH fixed it for me.

/usr/bin/make: no such file or directory

I recently installed Mac OS X on my system. This is probably a very basic question but when I run make it says make not found and there is no make under usr/bin. How to correct this?
The easiest way to get make, gcc and so on is to install Xcode (this can be found on the 'Applications' DVD that came with your computer, or you can download it from the Apple website, or you can download it from the App Store).
However, the Apple versions of those packages are old - you can use MacPorts to get newer, improved versions of those.

GCC without Xcode on OS X

I've just unwrapped my new MacBook Pro (yay!) and am now setting it up properly for development. Since I want to avoid clutter, I'm wondering if I really need to install the Xcode tools at all (I never use the IDE or Mac specific tools), since I'll install a newer version of GCC anyway, using MacPorts.
So, is there any benefit in installing Xcode? Is it necessary? What kind of set-up does it do behind the scenes? Basically: can I skip this or will it come back to haunt me because some Unix development tools just assume that OS X is always set up in this way?
In order to perform an easy and successful install of MacPorts, already having tools from the xCode installer is necessary. You only need the install option that places a copy of the unix/header files outside of xcode; everything else can remain uninstalled.
A friend of mine recently released this:
https://github.com/kennethreitz/osx-gcc-installer
Have fun :)
I tried this trick and I was constantly chasing missing header files and such. Just install XCode.
We primarily use the Xcode IDE for building Cocoa/Carbon applications. Xcode typically has different project templates (and project settings fixed accordingly). As long as you are not going to generate a Universal Binary or a framework I think you should be ok. As far as I am concerned, when I am too pissed with Xcode, I go back to the command line, set up the paths myself and start using GDB.
First of all, congratulations on the new MBP. I recently bought a 15" unibody myself. =)
You can safely skip Xcode installation, and you can install almost everything Xcode installs through MacPorts, except Xcode itself, of course.
However, I believe you'll find yourself installing Xcode one day anyway, and installing Xcode is much easier than installing all the tools (especially GCC) through MacPorts.
You can strip down the Xcode install quite a lot - when you install Xcode there is a "Customise" button where you can remove a lot of stuff (gigabytes worth).
You can also go in and delete stuff from /Developer/, for example the 10.3 SDK is about 150MB (I think), and if you're not writing software for that it's quite safe to delete. Obviously be careful when deleting, but if you break things, you can always reinstall the Developer Tools!
Apple now provides the command line tools as a separate download from Xcode. They work with Lion and Mountain Lion. You can download them from the Apple Developer Center.
(This is noted on the osx-gcc-installer GitHub page.)

Resources