Mac

De Pontão Nós Digitais

We provide information on how to run free software and general free software development on Mac OS X. Our instructions are not exactly radically about pure "free" software, but focus on advanced usage and software development that may be useful for creating free software.

Configuring Mac OS X for development

  • I didn't use a package manager at first and installed the following by going directly to the websites
    • Firefox, Chrome
    • Git
    • Google voice plugin
    • Libreoffice
    • Transmission bit torrent client
  • Install an IRC client from the app store
  • Install XCode from the app store
    • Go to XCode -> Preferences -> Downloads and install command line tools for xcode
  • Change capslock to control key in system preferences -> keyboard ->
  • Learn the trackpad gestures. They're useful. Activate the four finger gesture for exposee. The trackpad can do amazing stuff and in a couple of months you may quite comfortaby abandon the mouse even for complicated tasks.
  • Turn off stupid autocorrection
  • Vim
    • install macvim if you want to have something like gvim; otherwise its already in the system
    • Firefox is still the best browser for wiki editing. Install its all text plugin and use macvim as the app.
  • /home vs /User
    • I disabled automount of /home then symlinked to my home directory using this [1]
  • Function keys to behave as function keys
    • System Preferences -> Keyboard -> Keyboard -> checkbox "Use all F1, F2, etc. as standard function keys"
  • iTerm2 is a better terminal than Terminal [2]
  • X11. I installed XQuartz directly from the site's .dmg package. Rumors on the web say the macports xorg package has some issues.
  • espeak. I installed from the mac package in sourceforge. didn't find it in macports
  • KDE: see Setting up a KDE/MacPorts development environment

Latex

  • I installed Latex from downloading a torrent form the Mactex website. Once you install it, to get a 'latex' or 'pdflatex' command in the terminal without restarting your computer you need to issue:
eval `/usr/libexec/path_helper -s`

since in OS X there is a path helper that updates system-wide PATH according to ls /etc/paths.d/* for you.

  • Importing equations into Keynote and later editing the latex code is quite easy [3]

What I've installed using Macports

Some apps are newest in macports and are easier to install using it than downloading installers from each website.

sudo port install kdenlive gimp mplayer2 ddd pdftk okular evince nautilus inkscape xfig yasm zlib bzip2 faac lame speex libogg libvorbis libtheora libvpx x264 XviD openjpeg opencore-amr freetype py27-notify-python py27-ipython py27-matplotlib xmlindent astyle

Java

  • The maven build system already comes in Mac OSX mountain lion, but not in OSX Mavericks. Install it using homebrew.
  • I installed JDK by typing java in google and clicking on the oracle website. If you need java 6 then you need to logon to developer.apple.com and get it there.
  • I installed ant using homebrew in Mavericks
  • To understand Java paths and how to work with different versions, see [4] (beware of sloppy english)
  • Installed .jar's are to be placed in /Library/Java/Extensions or ~/Library/Java/Extensions for individual users.

Python

You'll likely end up with two pythons, from macport and from the system. You should set the macport ones like this:

sudo port select --set python python27

Now you can install and use python modules through macports.

Package Managers for Programming

Currently there are many package managers for Mac OS X emulating the ones available in Linux. In fact, the main advantage of linux I've perceived so far is the availability of solid package management so that you can get a full-fledged development system up and running from scratch automatically. In Mac OS not everything can be done automatically, and dev packages do not seem to be as rock solid as in GNU/Linux.

  • Fink
    • This seems to be mentioned in building many free software such as Scilab and Pd. It doesnt seem to be user friendly (for mountain lion one has to install fink from source)
    • From what I read, has many binary packages and works like apt-get
  • Macports
    • User friendly, but installs a layer of software in parallel to whats already in Mac OS X.
    • Building mozilla firefox supports macports
    • Latest kdenlive, gimp are available in macports
    • ImageMagick recommends macports
    • From what I read, no binary packages. But that's good since there's nothing like building from source from a developer's point of view.
    • Word has it that macports can have old/outdated packages, that's why people have switched to Homebrew. Many people use both.
    • Latest kdenlive video editor is only easily installed using Macports
    • Mplayer has many builds in macports, including mplayer2 and development snapshots
  • Homebrew
    • Somewhat user friendly and reuses most software thats already in Mac OS X - better integration with the system.
    • I've heard it on the web that it doesn't have as many packages as Macports,
    • An experienced friend said homebrew is sometimes unstable, having broken installations and packages
    • Homebrew has newer packages than macports according to rumors, however it seems to have fewer packages
    • Building mozilla firefox supports homebrew
    • My experienced friend uses both macports and homebrew
    • Mplayer2 doesn't seem to be available in homebrew

Macports: tips for programmers

List the contents of a package or 'port'

port contents qt4-mac         # or any other installed package

Which package/port provides a file

port provides filename

Webcams

  • For the PS3_Eye I installed macam from the website, but it doesn't work properly [5] #fail

System Automation

  • Configuring mac os x from the commandline [6]
  • Boxen

Installing Linux on a Mac

There are two options, running Linux on top Mac OS X using something like VMware, parallels desktop, virtualbox, or installing linux natively.

Macbook pro early 2013

I will here report my experience on installing linux on a early 2013 macbook pro.

Links

See Also

Configuring Ubuntu for Programming

Informal Notes

Using old scanners and printers through SANE

OSX is known not to support old printers and scanners. My printer, for instance, is an HP PSC 1315 all-in-one printer for which there is no easy scanning support in OSX Mavericks except from certain paid apps. I was about to buy another printer when I decided to seriously make it work (since it worked perfectly on Linux, then it should work here too with the appropriate open source tools).

What worked for me was to install SANE through macports (though I also installed the actual packages and have both versions on the system)[7]. Then you should install the HPLIP backend to SANE[8]. Version 3.14.4 worked fine for me. Even though this is called 'hplip', theactual SANE backend is 'hpaio'.

I compiled HPLIP from source and had to do some actual development to get the drivers to compile - no easy task: changing some configure.in's, include directives, and some substitutions of conflicting variable names. I made my changes available to HPLIP source code for OSX on Github [9]. To download it, do:

git clone https://github.com/rfabbri/hplip.git

I had to configure like so:

LDFLAGS="-L/opt/local/lib/" CPPFLAGS="-I/opt/local/include" ./configure

Fix location of USB to point to macports lib without altering HPLIP's hastly written Makefile.am

sudo ln -s /opt/local/include/libusb-1.0 /usr/local/include

I then finally compiled the whole thing

make
make install

Next, to get SANE to recognize 'hpaio', you need to include a line with simply hpaio by itself in the file sane.d/dll.conf. HOWEVER, it turns out the usual location of this file is completely ignored by SANE in OSX! It actually the one in

/usr/local/etc/sane.d/dll.conf 

which counted for me. However, you should also add the hpaio line to the following redundant locations as well:

/etc/sane.d/dll.conf
/opt/local/etc/sane.d/dll.conf 

Once you do this, sane will find your scanner!!

scanimage -L 

A successfull output to that looks like:

device `hpaio:/usb/psc_1310_series?serial=BR51R3G0STO2' is a Hewlett-Packard psc_1310_series all-in-one

Then you can scan images as follows:

scanimage --device hpaio:/usb/psc_1310_series?serial=BR51R3G0STO2 > image.pnm

You can use Gimp or ImageMagicks' "display" to view this file. In imagemagick you can also generate a pdf from a bunch of pnm files:

convert *pnm document.pdf

Your scanner that was supposed to be thrash is now back to life! And works pretty decently, too (good speed and quality).


In case of any problems, can set the debug level to SANE and view which backends are being loaded. Usually, if you manage load hpaio then your scanner should work. Moereover, to get scanning to be faster, you should try disabling all other backends in dll.conf.

Below are some info about different tasks when running Linux on a mac.

AirPort (wifi)

Install All Required Application

Before it's start, install your system with required application bellow :

   sudo apt-get install build-essential automake make

Download the Patch

Download Following Source for compiling the driver (Broadcom BCM4331) and patching the kernel.

   compat-wireless
   the patches, here
   the latest version of bw43-fwcutter (version 015)
   Broadcom's proprietary driver to extract the firmware

Patching and Compiling

Make a folder named bcm4331 and put all file you have download there, then

   # tar xf compat-wireless-2011-08-27.tar.bz2
   # tar xf patch_bcm4331.tar.bz2
   # cd compat-wireless-2011-08-27/
   # patch -p1 < ../bcm4331-1.patch
   # patch -p1 < ../bcm4331-2.patch
   # patch -p1 < ../bcm4331-3.patch


Next, enable the driver

   # scripts/driver-select b43


Next, go to config.mk, find row 276 and remove `#`, so that become

   CONFIG_B43_PHY_HT=y

Compile and Install the driver

   # make
   # sudo make install

Unpack and Compile b43-fwcutter:

   # tar xf b43-fwcutter-015.tar.bz2
   # cd b43-fwcutter-015
   # make

Extract the firmware

   # tar xf ../broadcom-wl-5.100.138.tar.bz2
   # export FIRMWARE_INSTALL_DIR="/lib/firmware"
   # sudo ./b43-fwcutter -w "$FIRMWARE_INSTALL_DIR"  broadcom-wl-5.100.138/linux/wl_apsta.o

Unload all related modules that use wireless

   # cd compat-wireless-2011-08-27
   # sudo make wlunload

Reboot your system and load compiled Wireless b43 module

   # sudo modprobe b43

Next, add the b43 to the list of modules so the system will load them on startup (the module is not automatically loaded).

   # cp /etc/modules /etc/modules.old
   # echo "b43" | sudo tee -a /etc/modules 

Next, Sometimes the driver does not work properly after suspend and hibernate. It is necessary to unload the module before putting the laptop to sleep and to reload it after wake up. For Ubuntu, it is sufficient to create the file (or append to the file)

   # cp /etc/pm/config.d/default /etc/pm/config.d/default.old
   # echo 'SUSPEND_MODULES="b43"' >> /etc/pm/config.d/default

Yes it is.. I realy hope this will fix the MBP Wireless problem issue.

From http://www.ubuntubuzz.com/2011/10/macbook-pro-wireless-broadcom-bcm4331.html

Atualizar fw do AirPort quando atualizar Ubuntu

Os arquivos estão em ~/tmp.

   sudo su
   cd compat-wireless-2011-08-27/
   ./scripts/driver-select b43
   make
   make install
   cd ../b43-fwcutter-015
   make clean
   make
   export FIRMWARE_INSTALL_DIR="/lib/firmware"
   ./b43-fwcutter -w "$FIRMWARE_INSTALL_DIR"  broadcom-wl-5.100.138/linux/wl_apsta.o
   cd ../compat-wireless-2011-08-27/
   make wlunload
   modprobe b43

Red Light at Mic (mini-HAL 9000)

Adicione o seguinte comando nos Aplicativos de sessão do Ubuntu

   amixer set IEC958 off

Desligar bluetooth por padrão

Adicione o seguinte comando nos Aplicativos de sessão do Ubuntu

   rfkill block bluetooth

Jack

Edite /etc/modprobe.d/alsa-base.conf e adicione essa linha:

   options snd-hda-intel position_fix=1 model=mbp55

Depois rode:

   sudo alsa force-reload

Se quiser rode o jackd na mão:

   jackd -dalsa -Strue -p4096

Senão, rode o qjackctl e configure esses valores:

   Realtime OK
   Force 16bit OK
   
   Priority 0 (default)
   Frames/Period 4096
   Sample Rate 48000
   Periods/Buffer 2
   Port Maximum 128
   Timeout 5000
   Start Delay 2
   
   Audio Duplex


Tema GTK3, Ícones e Fontes

Usando Gnome 3 (gnome-shell).

Baseando-se em http://mmesantos1.deviantart.com/art/eOS-Dev-Screenshot-09-03-12-325076457