MacOS – How to install Xcode 4.2.1 for OS X Lion 10.7.5

installmacosmacportsxcode

These instructions say "install xcode", but then say "once you have xcode installed". Pardon, didn't they skip a step? How do you install xcode?

2.1.1. Install Xcode on OS X 10.9 or later

Download the latest version of Xcode from the Apple developer website
or get it using the Mac App Store.

Once you have Xcode installed, open a terminal, run xcode-select
–install, …

Granted, I'm not running 10.9. Here's my version's instructions:

2.1.4. Install Xcode on older releases of Mac OS X

If you have an earlier release of Mac OS X, you may download the
latest version of Xcode for OS X 10.5 (Xcode 3.0 and Xcode 3.1
Developer Tools) or 10.4 (Xcode 2.4.1 and Xcode 2.5 Developer Tools)
from the Apple developer website.

Ensure that those of the following options that are available in the
installer for your version of Xcode are selected:

UNIX Development
System Tools
X11 SDK
Command Line Support

I downloaded installxcode_421_lion.dmg for this system:

System Software Overview:

  System Version:   Mac OS X 10.7.5 (11G63)
  Kernel Version:   Darwin 11.4.2
  Boot Volume:  Untitled
  Boot Mode:    Normal
  Computer Name:  a MacBook
  User Name:    thufir (thufir)
  Secure Virtual Memory:    Enabled
  64-bit Kernel and Extensions: No
  Time since boot:  7 minutes

I double click the download and install it to Applications? Sorry, this is an alien process.

After thinking I'd installed xcode, I get presented with:

Brents-MacBook:~ thufir$ 
Brents-MacBook:~ thufir$ sudo port install mysql5 +server
Error: 
Error: No Xcode installation was found.
Error: Please install Xcode and/or run xcode-select to specify its location.
Error: 
Warning: xcodebuild exists but failed to execute
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Warning: Xcode does not appear to be installed; most ports will likely fail to build.
Warning: You downloaded Xcode from the Mac App Store but didn't install it. Run "Install Xcode" in the /Applications folder.
--->  Computing dependencies for mysql5Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option

--->  Dependencies to be installed: openssl zlib readline ncurses tcp_wrappers
--->  Fetching archive for zlib
--->  Attempting to fetch zlib-1.2.8_0.darwin_11.x86_64.tbz2 from http://packages.macports.org/zlib
--->  Attempting to fetch zlib-1.2.8_0.darwin_11.x86_64.tbz2.rmd160 from http://packages.macports.org/zlib
--->  Installing zlib @1.2.8_0
--->  Activating zlib @1.2.8_0
--->  Cleaning zlib
--->  Fetching archive for openssl
--->  Attempting to fetch openssl-1.0.2_0.darwin_11.x86_64.tbz2 from http://packages.macports.org/openssl
--->  Attempting to fetch openssl-1.0.2_0.darwin_11.x86_64.tbz2.rmd160 from http://packages.macports.org/openssl
--->  Installing openssl @1.0.2_0
--->  Activating openssl @1.0.2_0
--->  Cleaning openssl
--->  Fetching archive for ncurses
--->  Attempting to fetch ncurses-5.9_2.darwin_11.x86_64.tbz2 from http://packages.macports.org/ncurses
--->  Attempting to fetch ncurses-5.9_2.darwin_11.x86_64.tbz2.rmd160 from http://packages.macports.org/ncurses
--->  Installing ncurses @5.9_2
--->  Activating ncurses @5.9_2
--->  Cleaning ncurses
--->  Fetching archive for readline
--->  Attempting to fetch readline-6.3.003_0.darwin_11.x86_64.tbz2 from http://packages.macports.org/readline
--->  Attempting to fetch readline-6.3.003_0.darwin_11.x86_64.tbz2.rmd160 from http://packages.macports.org/readline
--->  Installing readline @6.3.003_0
--->  Activating readline @6.3.003_0
--->  Cleaning readline
--->  Fetching archive for tcp_wrappers
--->  Attempting to fetch tcp_wrappers-20_2.darwin_11.x86_64.tbz2 from http://packages.macports.org/tcp_wrappers
--->  Attempting to fetch tcp_wrappers-20_2.darwin_11.x86_64.tbz2.rmd160 from http://packages.macports.org/tcp_wrappers
--->  Installing tcp_wrappers @20_2
--->  Activating tcp_wrappers @20_2
--->  Cleaning tcp_wrappers
--->  Fetching archive for mysql5
--->  Attempting to fetch mysql5-5.1.72_0.darwin_11.x86_64.tbz2 from http://packages.macports.org/mysql5
--->  Attempting to fetch mysql5-5.1.72_0.darwin_11.x86_64.tbz2 from http://mse.uk.packages.macports.org/sites/packages.macports.org/mysql5
--->  Attempting to fetch mysql5-5.1.72_0.darwin_11.x86_64.tbz2 from http://lil.fr.packages.macports.org/mysql5
--->  Fetching distfiles for mysql5
--->  Attempting to fetch mysql-5.1.72.tar.gz from http://distfiles.macports.org/mysql51
--->  Verifying checksums for mysql5                                                 
--->  Extracting mysql5
--->  Applying patches to mysql5
--->  Configuring mysql5
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Error: Failed to configure mysql5, consult /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_databases_mysql5/mysql5/work/mysql-5.1.72/config.log
Error: org.macports.configure for port mysql5 returned: configure failure: command execution failed
Please see the log file for port mysql5 for details:
    /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_databases_mysql5/mysql5/main.log
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
Error: Processing of port mysql5 failed
Brents-MacBook:~ thufir$ 
Brents-MacBook:~ thufir$ 
Brents-MacBook:~ thufir$ cd /Applications/
Brents-MacBook:Applications thufir$ 
Brents-MacBook:Applications thufir$ pwd
/Applications
Brents-MacBook:Applications thufir$ 
Brents-MacBook:Applications thufir$ Install xcode
usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
               [-o owner] file1 file2
       install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
               [-o owner] file1 ... fileN directory
       install -d [-v] [-g group] [-m mode] [-o owner] directory ...
Brents-MacBook:Applications thufir$ 
Brents-MacBook:Applications thufir$ Install Xcode
usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
               [-o owner] file1 file2
       install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
               [-o owner] file1 ... fileN directory
       install -d [-v] [-g group] [-m mode] [-o owner] directory ...
Brents-MacBook:Applications thufir$ 
Brents-MacBook:Applications thufir$ ls
AV for InDesign CS6.app         Font Book.app               Mission Control.app         Thunderbird.app
Address Book.app            GPG Keychain.app            MySQLWorkbench.app          Time Machine.app
AdwareMedic.dmg             GPG_Suite-2015.02-b5-1161.dmg       Nimbuzz.app             ToneSync-1.0.3.dmg
App Store.app               Google Chrome.app           OneDrive.app                Utilities
Automator.app               Image Capture.app           Photo Booth.app             VLC.app
BitTorrent.app              Install Xcode.app           Preview.app             XChat Azure.app
Calculator.app              Jitsi.app               QuickTime Player.app            YateClient.app
Chess.app               Kodi.app                RarGenie.app                iCal.app
ChordsMaestroLite.app           Launchpad.app               Resume Builder.app          iChat.app
DVD Player.app              Learn Photoshop CS 5 Edition Free.app   Safari.app              iTunes.app
Dashboard.app               MPlayerX copy.dmg           SketchBookExpress.app           refind-flashdrive-0.8.5.zip
Dictionary.app              MPlayerX.dmg                Skype.app               vlc-2.1.2.dmg
FaceTime.app                MacFonts.dmg                Stickies.app
Firefox 36.0.1.dmg          Mail.app                System Preferences.app
Firefox.app             Microsoft Office 2011           TextEdit.app
Brents-MacBook:Applications thufir$ ./Install\ Xcode.app/
-bash: ./Install Xcode.app/: is a directory
Brents-MacBook:Applications thufir$ 

So I need to run Install Xcode, which, apparently, isn't a script or executable…I'll click it with the mouse. For posterity, I thought I'd at least mention this to anyone else that there's an extra thing to do to install XCode.

Best Answer

Yes, you can install it in /Applications.