Posts about macos (old posts, page 2)

2012-03-05 Completely disable quarantine of downloaded files

copy and paste from

Starting in Leopard when you open a file downloaded from the web, OS X asks if you really mean it. While it is intended to stop maliciousness, it is only a source of aggravation for me. While there are some hints here on working around it, it turns out that you can disable it completely using a Terminal command:

defaults write LSQuarantine -bool NO

After that, reboot.

To know the state of your system, use

defaults read LSQuarantine

, to go back to default, use

defaults write LSQuarantine -bool YES

2012-01-18 Compiling pyglet on MacOsX

2012-01-18 11:18:03
  • you may get errors if trying to install pyglet using the traditional way, using pip for instance (was my case on MacOs X Lion 10.7.0 + python 64bits from EPD or homebrew). in cause is the carbon code that has been abandonned in the 64bits libraries that come with the OS
  • the solution comes from the package
    1. clone the package hg clone 
    2. insert the code in your PYTHONPATH: rsync -av cocoapy /usr/local/lib/python2.7/site-packages/pyglet/libs/darwin
  • a simpler solution is to install the pyglet code from :
    1. hg clone
    2. cd evilphillip-cocoa-ctypes2/
    3. python install
  • works!

2011-07-10 mounting filesystems using SSH

2011-07-12 11:51:19

install on ubuntu

  1. $ sudo apt-get install sshfs
    [sudo] password for toto:
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following NEW packages will be installed
    0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
    Need to get 43.7 kB of archives.
    After this operation, 160 kB of additional disk space will be used.
    Get:1 natty/main sshfs amd64 2.2-1build1 [43.7 kB]
    Fetched 43.7 kB in 0s (1,477 kB/s)
    Selecting previously deselected package sshfs.
    (Reading database ... 342224 files and directories currently installed.)
    Unpacking sshfs (from .../sshfs_2.2-1build1_amd64.deb) ...
    Processing triggers for man-db ...
    Setting up sshfs (2.2-1build1) ...
  2. $ sudo gpasswd -a $USER fuse
    Adding user toto to group fuse

install on macosx

  1. install
  2. follow
  3. (!) on a 64 bits system, you have to install a proper version, follow

using sshfs (mac and ubuntu)

  1. Create a mountpoint and give yourself ownership
    sudo mkdir /media/mount-name
    sudo chown your-username /media/mount-name
  2. Mount the filesystem
    sshfs remote-system-name:/remote-folder /media/mount-name
  3. Unmount the filesystem
    fusermount -u /media/mount-name

automating the process sshfs (mac and ubuntu)

  1. script to :
    mkdir ~/spawn
    sshfs toto@server:~/spawn ~/spawn
  2. script to unmount :
    fusermount -u  ~/spawn
    rmdir ~/spawn

2011-07-07 using a versioning system

using SubVersion (SVN)

Version Control is an everyday tool to handle your important source files. It is useful:

  • to grab the latest source code from open source projects and to always keep up-to-date,
  • to share a bunch of files (a set of latex source code, python scripts, ...) allowing to work on different computers with different persons,
  • to keep track of revisions from your project.

SVN: Getting help

SVN: 2 minutes guide using the commandline

  • to just access a remote repository and make a local working copy ("checking-out") in a local my_projects folder, do
    cd my_projects/
    svn checkout svn+ssh://myname@svnserver/path/to/svn/project my_localcopy

    this basically copies the current version of the remote copy to your local computer as the folder my_localcopy. Then, you just need to issue svn up in this folder to stay up-to-date.

  • to create from scratch your own folder in an existing repository (, do
    cd my_projects/
    svn add new_project
    svn ci new_project -m'Committing my modifications'

    . Then you just need to issue the svn ci new_project -m'Committing my modifications' command to commit new modifications to the server. Don't forget to svn add newfiles or to svn rm obsolete_files.

random SVN tips

  • roll-back to a previous version (e.g. 3421) of a file myfile:
    svn up -r 3421 myfile
  • Create a repository
    • use the database backend
      svnadmin create /ih/funk/svn/projects
  • use the filesystem backend
    svnadmin create --fs-type=fsfs PATH
  • Import a revision
    svn import -m "Initial import" Eccos file:///ih/funk/svn/projects
  • Check out a revision
    svn co file:///ih/funk/svn/projects
  • Dump a repository
     svnadmin dump /ih/funk/svn/projects | gzip -9 > dump.gz
     svnadmin dump /ih/funk/svn/projects | gzip -9 > `date "+Eccosdump%Y-%m-%d_%H:%M:%S.gz"`
    svnadmin dump /ih/funk/svn/projects | gzip -9 > `date "+projects_dump%Y-%m-%d_%H:%M:%S.gz"`
  • Load contents of a dump into a repository
    gunzip -c dump.gz | svnadmin load /data/svn/projects
  • Import from an existing directory, no need to check it out again
    • It should work, but you could also check it out right into /etc. Something

      like this:

      $ svnadmin create /var/svnrepos/admin
      $ svn mkdir -m "initial setup" file:///var/svnrepos/admin/trunk
      c:> svn mkdir -m "initial setup" file:///c:/fhs/svn_repos/trunk
      $ cd /etc
      $ svn co file:///var/svnrepos/admin/trunk .
      $ svn add passwd group
      $ svn commit -m "start loading it in"
      I tested the 'svn co' into '.' just now. Works great.
  • svn propset
    svn propset svn:keywords "LastChangedDate LastChangedRevision Id Author" weather.txt
    svn propset svn:keywords "LastChangedDate LastChangedRevision Id" slides.tex
  • Before an update you could use the following to get the log messages of the changes:
    svn log -rBASE:HEAD
  • Upgrade to a new subversion version
    $ mv repos repos.tmp
    $ svnadmin create repos
    $ svnadmin-old dump repos.tmp | svnadmin load repos
    $ # copy over any hook scripts and stuff from repos.tmp to repos
  • Checkout from a repository over ssh
    svn co svn+ssh://felix/home/reichr/svn_repos/XSteveData/trunk data
  • Change the path of the repository for a working copy
    svn switch --relocate file:///original/path/to/repos file:///new/path

    alert WARNING: this will not work if file:///original/path/to/repos is not exactly the original URL. BE sure to check before with svn info.

  • Network a repository via svn+ssh:
    • create the repository on the repository host:
      svnadmin create rp1  -- this is located at /home/svtest/rp1
    • Import data to the repository:
      svn import -m"Initial import" svn+ssh://svtest@host/rp1/trunk
    • Checkout the project:
      svn co svn+ssh://svtest@host/home/svtest/rp1/trunk p1
  • Generate a patch to undo some local changes and redo them later: What usually happens to me is that I've changed N files in M different > directories distributed all over the filesystem, and I want to check in N-1 of them. If I need to commit all but one file, I do this:
    % svn diff path/to/file_not_committing > /tmp/patch.txt
    % svn revert path/to/file_not_committing
    % svn ci -m "committing all the stuff i wanted to"
    % patch -p0 < /tmp/patch.txt

    Revert is your friend. Learn it, use it, looooooooooove it.

  • Revert to a previous version
    svn co project
    <edit foo.c, adding bugs>
    svn ci foo.c (commits to r348)
    <realize terrible error>
    svn merge -r348:347 foo.c
    svn ci foo.c (commits 349)

    note the ordering of the revision numbers in the merge command. what this really says is "make a diff between revision 348 and 347, and apply it immediately to foo.c" if you are trying to revert a directory tree with moves or deletes in it, and are getting arcane errors, try the --ignore-ancestry flag.

  • Edit the commit/log messages after the commit Read chapter 7, regarding unversioned properties attached to revisions. You want to change the svn:log property:
    $ svn propedit -r N --revprop svn:log URL

an alternative : Git

git clone url svn checkout url
git pull svn up
git commit svn commit
git push url (no such a thing)
  • to set-up
    git config --global "Your Name Comes Here"
    git config --global
    git config --global color.diff auto
    git config --global color.status auto
    git config --global color.branch auto

using Git with SVN

  • install git-svn and use
    git svn fetch

2011-02-22 Change User ID and Group ID in Snow Leopard

2011-02-22 09:49:34
  • find source and traget UID / GID using the id command on unix and dscl localhost read /Local/Default/Users/lup in MacOsX
  • from :
    dscl . -change $HOME UniqueID 41167 545
    dscl . -change $HOME PrimaryGroupID 41167 1007
    chown -R 545:1007 $HOME
  • Remember to run the chown command afterwards, or you will not be able to access your home directory. Finally, log out and log in.
  • you may have to propagate changes on other drives (backup disks and such)

2011-02-09 pmset: selecting the sleep mode in Mac Os X

2011-02-09 09:46:10

To select one of the different sleep modes of the Mac use the command-line tool pmset:

  • To show the current settings:
    pmset -g
  • The hibernatemode can be 3 (default: safeSleep, i.e. the RAM content is also written to disk when the lid is closed), 0 (pure RAM sleep), 1 (pure deep-sleep). Turn the safeSleep off:
    sudo pmset -a hibernatemode 0

2011-01-19 inverting colors in MacOsX

  • during a presentation, a figure may reveal more readable if you invert colors and luminance: black gets white and reverse, red becomes cyan and so on.
  • this can be done on the fly using the magical ctrl + opt + command + 8 keyboard shortcut (on a french keyboard, press ! instead of 8).
  • a property linked to universal access (see that reference pane for other tricks)

2010-12-20 Caps Lock, what a useless key

2010-12-20 13:38:58

  1. [Ubuntu / gnome] You should be disable it do this with System->Preferences->Keyboard->Layouts-> Options...->CapsLock key behavior
  2. [MacosX] Open System Preferences, select the Keyboard pane. Within here, click the Modifier Keys… button at the bottom. To disable the Caps Lock key, pull down the associated menu and select No Action.

2010-11-04 installing Dovecot on MacOsX using MacPorts

2010-11-05 15:40:38
  • master howto:
  • Install
    sudo port install dovecot
    sudo port load dovecot
  • Configure
    sudo cp /opt/local/etc/dovecot/dovecot-example.conf  /opt/local/etc/dovecot/dovecot.conf
    sudo vim /opt/local/etc/dovecot/dovecot.conf
  • Mine reads (it's just meant to access imap files from the local mail server and not to serve outside the localhost):
    protocols = imap
    listen = localhost:10143
    disable_plaintext_auth = no
    ssl = no
    mail_location = maildir:~/Maildir
    protocol imap {
    auth default {
      mechanisms = plain
      passdb pam {
        args = login
      userdb passwd {
          args =
    user = root
    dict {
  • Reload
    sudo launchctl stop org.macports.dovecot
    sudo launchctl start org.macports.dovecot
  • It does not work on the first try... so read documentation
    less /opt/local//share/doc/dovecot/documentation.txt
    less /opt/local//share/doc/dovecot/auth-protocol.txt
    less /opt/local//share/doc/dovecot/wiki/PasswordDatabase.PAM.txt
  • Authentification
    ls -l /etc/pam.d/
    sudo vim /etc/pam.d/dovecot

    with /etc/pam.d/dovecot being

    auth       required
    account    required
    password   required
    session    required