apt-get command not found error

I originally posted this in the wrong place and this forum was suggested as a better home for this question. I hope someone can kindly lend me a hand, thanks.....:

So, after years of procrastinating I finally got around to sitting down and trying to use my mac mini (1.66 GHz Core Duo) as a web server with PHP5 and mysql. I've got it all working nicely, except for the darn GD library. I'm trying to create a captcha image that uses the imagecreatefrompng() PHP function. I get this error:

Fatal error: Call to undefined function imagecreatefrompng() in /Users/me/Sites/mysite/captcha.php on line 3

Like any good hodge podge comp user, I spent hours on google trying to find the solution to this and I found that most people needed to edit their php.ini file to uncomment the line:

"extension=php_gd2.dll"

So, I did this in my php.ini file and restarted apache, but to no avail - the error to "undefined function" persisted. So I kept looking and found that I needed to perhaps install the gd library first, so that PHP could use it! So, I found many people having success with this command in terminal:

sudo apt-get install php5-gd

I did this in my terminal window, but ofcouse, to no avail! I get asked for my password, and after entering it I get this error:

My-Laptop:~ me$ sudo apt-get install php5-gd
Password:
sudo: apt-get: command not found

I really don't know much about the terminal, but for some reason the apt command isn't taking the -get option. I tried with a space after the dash in "apt-get", but I get another error I can't make much sense of:

My-Laptop:~ me$ sudo apt -get install php5-gd
apt: invalid flag: -get
Usage: apt <apt and javac options> <source files>
where apt options include:
-classpath <path> Specify where to find user class files and annotation processor factories
-cp <path> Specify where to find user class files and annotation processor factories
-d <path> Specify where to place processor and javac generated class files
-s <path> Specify where to place processor generated source files
-source <release> Provide source compatibility with specified release
-version Version information
-help Print a synopsis of standard options; use javac -help for more options
-X Print a synopsis of nonstandard options
-J<flag> Pass <flag> directly to the runtime system
-A[key=value] Options to pass to annotation processors
-nocompile Do not compile source files to class files
-print Print out textual representation of specified types
-factorypath <path> Specify where to find annotation processor factories
-factory <class> Name of AnnotationProcessorFactory to use; bypasses default discovery process
See javac -help for information on javac options.

I'd really appreciate any pointers on how to make this apt command work as it seems to work for others, but not me . I'm stumped, I've tried loads of things and am willing to try loads more until this works!

Many thanks!

Mac mini, Mac OS X (10.5.6)

Posted on Apr 14, 2009 9:57 PM

Reply
4 replies

Apr 14, 2009 11:23 PM in response to jpimbert

Ouuu, nice! Thanks for that jpimbert!

I installed Fink (admittedly not knowing fully what I was doing), and apt-get is now seemingly a valid command since I can get a manual page for it by typing in:

man apt-get

So off I go and tried the famous "sudo apt-get install php5-gd" command, all excited and such, and got this error:

My-Laptop:~ me$ sudo apt-get install php5-gd
Reading Package Lists... Done
Building Dependency Tree... Done
E: Couldn't find package php5-gd

So close! Argh. I suspect now the problem is the "gd" package I want to install isn't called -gd but something else? If so I guess that's as far as this forum can take me, unless someone happens to know? I plan to hit google up for some clues now.

Thanks again!

Apr 15, 2009 5:13 AM in response to TangoKilo

When doing your Google searches, make sure you prefix the search string with "Mac" so that you get Mac OS X based solutions. Solutions which give you Linux solutions will make assumptions about tools (such as apt-get) that may not exist on Mac OS X.

Also there are 2 sources of ported Open Source packages for Mac OS X.

<http://www.finkproject.org/>
<http://www.macports.org/>

Fink, which you already know uses the apt-get base package manager, but Fink also has the FinkCommander GUI interface that makes installing these packages "Point and Click".

MacPorts using the 'port' command, but it too has a GUI interface via Porticus.

Apr 16, 2009 5:09 PM in response to BobHarris

Thanks Bob, that's very helpful info.

As it turns out, fink did the trick, but couldn't find the gd package despite others having success with that approach - very annoying.

I ended up finding a php5 version with the gd library already in it from entropy.com (I think) so I installed that and changed the apache httpd.conf file to point to the new php5 library, restarded apache and that fixed the problem!

As usual, however, this mucked something up with php's connection to mysql. So I had to re-point php to /usr/local/mysql (or something similar, I can't remember that well) to get it to enable proper access to mysql. Despite doing this, I can't connect to mysql still, where it was working before I did this change of php versions! So, that's where I'm at, but the initial problem I had when posting this has been solved, so many thanks to you and jpimbert for you prompt and helpful tips!

It's such a battle getting this all set up, but I'm learning loads whilst doing it so I guess it's good in a sense, just very tedious. I hope that anyone having my exact problem can now stumble on this post and use it to overcome it quicker than the 1.5 days it took me to do so!

Thanks again to you both.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

apt-get command not found error

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.