Golang on Mac : Xcode as a requirement

4,015 views
Skip to first unread message

bsr

unread,
Aug 14, 2011, 1:14:30 AM8/14/11
to golang-nuts
Hello,
I was quite actively using golang on linux, and just bought a mac
book. As a first time user of Mac os ( System Version: Mac OS X 10.7
(11A2063), Kernel Version: Darwin 11.0.1 ), I am not sure how to set
it up for golang development. A quick pointer would help me a lot.

Do I need Xcode for development. I hate that apple need the credit
card info to setup the account to download this free application. It
is also > 2GB, which is significant compare to the memory available in
mac book air. I am not sure whether I can reduce the installation
space by choosing only the required component for golang development,
please advise.

Thanks,
bsr

Dave Cheney

unread,
Aug 14, 2011, 1:26:12 AM8/14/11
to bsr, golang-nuts
AFAIK you need Xcode installed to build go, partially for gcc, partially for the extra tools like bison et al, and partially for the headers.

Alternatives like fink or macports will also need gcc to bootstrap, but I did see one contributor to the list trying to compile with a precompiled gcc package.

In short, this will probably not work without Xcode and you will spend a lot of your free time trying. If there is one consultation I am told that in most countries you can create an ITunes account using a prepaid gift card avoiding the requirement to disclose your CC details to apple.

Cheers

Dave

Sent from my iPad

On 14/08/2011, at 15:14, bsr <bsr...@gmail.com> wrote:

> Hello,
> I was quite actively using golang on linux, and just bought a mac
> book. As a first time user of Mac os ( System Version: Mac OS X 10.7
> (11A2063), Kernel Version: Darwin 11.0.1 ), I am not sure how to set
> it up for golang development. A quick pointer would help me a lot.
>
> Do I need Xcode for development. I hate that apple need the credit

> card info to ftsetup the account to download this free application. It

Francisco Souza

unread,
Aug 14, 2011, 1:39:18 AM8/14/11
to Dave Cheney, bsr, golang-nuts
You're a developer, you're on a Mac, install Xcode.

You can try some workarounds, like the osx-gcc-installer [1], and them build everything else, but I still do recommend you to install Xcode (or Linux ;D)


Cheers,
Chico (a.k.a Francisco Souza)
@franciscosouza

andrey mirtchovski

unread,
Aug 14, 2011, 1:46:58 AM8/14/11
to Francisco Souza, Dave Cheney, bsr, golang-nuts
you can download xcode from other sites. no need to give any cc info:

http://mac.softpedia.com/get/Development/Compilers/Apple-Xcode.shtml

bsr

unread,
Aug 14, 2011, 1:51:33 AM8/14/11
to golang-nuts
Dave, Chico,
Thank you very much for the advice.. I could create an account
without credit card, needed to just fill in the address and choose
payment type none.

Another question, may be unrelated. Is there any difference in
programming between linux and OSX platform. What I mean is if I have a
codebase which so far been developed and tested on linux can I just
build and run the same source on Mac (with Xcode or whatever)

Tx,
Bsr

On Aug 14, 1:39 am, Francisco Souza <franci...@franciscosouza.net>
wrote:

Dave Cheney

unread,
Aug 14, 2011, 1:55:47 AM8/14/11
to bsr, golang-nuts
>   Another question, may be unrelated. Is there any difference in
> programming between linux and OSX platform. What I mean is if I have a
> codebase which so far been developed and tested on linux can I just
> build and run the same source on Mac (with Xcode or whatever)

Assuming your codebase is pure Go (no cgo or inotify) then you will
probably experience very little difficulty. I've personally found the
portability of Go code to be excellent.

Cheers

Dave

James Keane

unread,
Aug 14, 2011, 1:57:45 AM8/14/11
to bsr, golang-nuts
Everything should be the same, all you really need to build go is to install mercurial and check out.  Installing Xcode provides all the build tools and necessary libraries.

Simply, cd src/ && ./all.bash (iirc)

You do not need to use Xcode to build, but Xcode installs gcc and such, which are necessary.

btw.  Good choice not to add a credit card to the apple account, I have just removed mine after my account was mysteriously accessed and $70 of my money disappeared.  Apple has fixed the issue but I am at a complete lost how my account was accessed and apple is not taking any responsibility!

-- 
James Keane

Matt Kane's Brain

unread,
Aug 14, 2011, 10:02:44 AM8/14/11
to Francisco Souza, Dave Cheney, bsr, golang-nuts
You can download LLVM binaries for OS X without XCode, and you could
conceivably use those to build a fresh GCC. (Or use the GCC LLVM
frontend, I guess.)

--
matt kane's brain
http://hydrogenproject.com
capoeira in boston http://capoeirageraisboston.com
aim -> mkbatwerk ; skype/y! -> mkb218 ; gtalk -> mkb.dirtyorg

Andrew Gerrand

unread,
Aug 14, 2011, 6:06:58 PM8/14/11
to golan...@googlegroups.com
Another reason we currently require Xcode on OS X is because it provides GNU make. You need make to do any reasonable Go development.

We're very close to making goinstall independent of make. When goinstall sans make is ready we will provide a precompiled Go toolchain and drop the Xcode requirement for developing Go code on a Mac.

Andrew 

Dave Cheney

unread,
Aug 14, 2011, 7:24:24 PM8/14/11
to golan...@googlegroups.com
Wow! Exciting stuff

Justin Israel

unread,
Aug 14, 2011, 7:46:51 PM8/14/11
to golang-nuts
Xcode didnt used to require an apple developer account I dont think
until the recent xcode 4.0. You used to just be able to grab it
openly.

gauravk

unread,
Aug 15, 2011, 9:22:28 AM8/15/11
to golang-nuts
Even with few limitations goinstall usage is far more convenient than
installing libraries for a major programing language which has
delivered 7th major release recently.

Kyle Lemons

unread,
Aug 15, 2011, 9:03:18 PM8/15/11
to Justin Israel, golang-nuts
You still don't need a developer account, it's available on the App Store.  Of course, the app store account probably requires a CC.
~K

Aram Hăvărneanu

unread,
Aug 16, 2011, 5:31:11 AM8/16/11
to Kyle Lemons, Justin Israel, golang-nuts
> You still don't need a developer account, it's available on the App Store.
>  Of course, the app store account probably requires a CC.

You can make an App Store account without a CC. Go to iTunes Store,
select US regardless of the actual country you are in, make an account
and when asked for the type of credit card select "none". You need to
go to the US store because this "none" option is only available there
(not for other countries' stores). Next go to App Store and log in
with your iTunes account.

--
Aram Hăvărneanu

Reply all
Reply to author
Forward
0 new messages