Posts about macos (old posts, page 3)

2013-03-13 shortcut to put the display to sleep

  • ⇧⌃⏏ (shift+control+eject)

Comments

2013-02-02 How To Change Your Time Machine Backup Interval

tl;dr sudo/usr/libexec/PlistBuddy-c'set:LaunchEvents:com.apple.time:"BackupInterval":Interval86400'/System/Library/LaunchDaemons/com.apple.backupd-auto.plist

method 1 : vim (or any editor)

  • open the file for edition

    sudo vim /System/Library/LaunchDaemons/com.apple.backupd-auto.plist
    
  • replace 36000 (one hour) by 86400 (one day), then quit:

    :%s/3600/86400/g
    :wq!
    

method 2 : plistbuddy

  • you can make it in one line:

    sudo /usr/libexec/PlistBuddy -c 'set  :LaunchEvents:com.apple.time:"Backup Interval":Interval 86400' /System/Library/LaunchDaemons/com.apple.backupd-auto.plist
    
  • this method use the PlistBuddy method to read / write the file. this utility can be used interactively

    sudo /usr/libexec/PlistBuddy  /System/Library/LaunchDaemons/com.apple.backupd-auto.plist
    
  • but also directly:

    sudo /usr/libexec/PlistBuddy -c 'print  ' /System/Library/LaunchDaemons/com.apple.backupd-auto.plist
    sudo /usr/libexec/PlistBuddy -c 'print  :LaunchEvents:com.apple.time ' /System/Library/LaunchDaemons/com.apple.backupd-auto.plist
    sudo /usr/libexec/PlistBuddy -c 'print  :LaunchEvents:com.apple.time:"Backup Interval" ' /System/Library/LaunchDaemons/com.apple.backupd-auto.plist
    sudo /usr/libexec/PlistBuddy -c 'print  :LaunchEvents:com.apple.time:"Backup Interval":Interval ' /System/Library/LaunchDaemons/com.apple.backupd-auto.plist
    sudo /usr/libexec/PlistBuddy -c 'set  :LaunchEvents:com.apple.time:"Backup Interval":Interval 3600' /System/Library/LaunchDaemons/com.apple.backupd-auto.plist
    

finally

  • reboot.

Comments

2012-09-30 discover ports on MacOSX

  • the network utility GUI is useful, but you may get the same results via the command line:
$ cd /Applications/Utilities/Network\ Utility.app/Contents/Resources/
$ ./stroke nas-meduz.local 548 550
Port Scanning host: 192.168.0.5

         Open TCP Port:         548             afpovertcp
$ ./stroke shazam.dyndns.org 548 550
Port Scanning host: 82.231.23.196

         Open TCP Port:         548             afpovertcp

Comments

2012-03-24 Type your paths directly

  • from http://apple.blogoverflow.com/2012/03/open-and-save-like-a-pro-secrets-of-opensave-dialogs/ :

    Let’s move on to a more advanced feature: the Go to Folder dialog. Like in Finder, you can access a prompt for typing a path by pressing ⇧+⌘+G. If you love the keyboard, you’ll love this dialog; frequently, the fastest way to get to where you want to go is by typing its path. This is especially true because the Go to Folder dialog features tab autocompletion: type the beginning of the name of a file or folder and hit tab to fill in the rest of the name automatically. My favorite part about the Go to Folder dialog is that it appears automatically whenever you begin typing a path (/ or ~). When saving, the desired filename can even be included in the path.
    

Comments

2012-03-22 how to leave iphoto

  • iphoto.app is certainly a nice tool, but it is also

    1. slow, unresponsive and locks you in some ugly closed-source format.
    2. also, try to look in forums when you want to share pictures on different {computers / OSs / iphoto versions / places / users} = nightmare!
    3. on top of that, the *cloud stuff is intellectually just very corrupted...
    4. what decided me to drop it entirely was a sudden corruption of the library. It took 2 days to recover my files and re-rotate correctly all pictures...
    5. last nail in the coffin was the fact that libraries are not backward compatible : you have to upgrade to the new product.
  • so time to take back possession of your pictures!

  • I found some supporting arguments here: http://accretiondisc.com/blog/2011/10/26/leaving-iphoto/

  • solution: put the files in folders according to a date organization of the type 2011/P0747444.jpg, other tools for tagging, etc... follow naturally (and you share as you share folders on dropbox or whatever)

  • first, let's set the default application for upcoming pictures from cameras:

    1. With your camera connected, open Image Capture
    2. You will see your camera under devices. Click the icon.
    3. Down at the bottom, you will see “Connecting this iPhone opens…” with a pull-down menu under it.
    4. select "autoimport" (I choose "delete after importation")
    5. another solution is to use a feature from dropbox...
  • then, let's export the data from iPhoto: File.../Export.... I kept the original file names but with the modifications (mainly rotations that were applied to my old camera without a gravity sensor). you should end up with lots of files in one directory. but it ... does not work as iphoto raises a completly unmeaningful error ('could not create file').

  • so, let's explore the library:

    1. it is package, and we can right-click in the finder to 'show package content'
    2. click the Masters folder to open it, and you'll see folders organized by year; inside are more folders organized by date and album, and inside them are photos in JPG format and video clips.
  • then I found https://github.com/BMorearty/exportiphoto and you just have to type

    python exportiphoto.py Pictures/iPhoto\ Library Pictures/Photos
    

    to achieve the export

    • I used the following commands to post-process all

      counting if everything was moved (there was some corruption in the library file with MOVies)
      find ~/Pictures/iPhoto\ Library/Masters/2012 -iname *MOV |wc -l
      find ~/Pictures/iPhoto\ Library/Masters -iname *MOV |wc -l
      find ~/Pictures/Photos -iname *MOV |wc -l
      
      # brute force to compare the content of the trees (brute force for the computer, you can get a coffee)
      mkdir ~/Pictures/Photos/2011
      chmod -R u+rwX ~/Pictures/Photos/2011
      find ~/Pictures/iPhoto\ Library/Masters/2011 -iname *MOV -exec cp {} ~/Pictures/Photos/2011/ \;
      mkdir ~/Pictures/Photos/2012
      find ~/Pictures/iPhoto\ Library/Masters/2012 -iname *MOV -exec cp {} ~/Pictures/Photos/2012/ \;
      

      (for the last exampls, see http://en.wikipedia.org/wiki/Xargs )

  • at the end, the great relief is to remove all this iphoto cr*p:

    cd ~/Pictures/
    rm -rf iPhoto*
    cd ~/Library/Caches
    rm -rf com.apple.iPhoto
    
  • I'll be glad to help anybody with similar problem

Comments

2012-03-21 installing Dovecot on MacOsX using HomeBrew

  • master howto: https://trac.macports.org/wiki/howto/SetupDovecot

  • Install

    brew install dovecot
    sudo vim /Library/LaunchDaemons/homebrew.mxcl.dovecot.plist
    
  • Configure

    sudo cp /usr/local/etc/dovecot/dovecot-example.conf  /usr/local/etc/dovecot/dovecot.conf
    sudo vim /usr/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):

    disable_plaintext_auth = no
    mail_location = maildir:~/Maildir
    ssl = no
    default_login_user = lup
    passdb {
      args = login
      driver = pam
    }
    protocols = imap
    service auth {
      user = root
    }
    service imap-login {
      inet_listener imap {
        address = 127.0.0.1
        port = 10143
      }
      inet_listener imaps {
        address = 127.0.0.1
        port = 10943
      }
    }
    userdb {
      driver = passwd
    }
    
  • Reload

    sudo launchctl unload homebrew.mxcl.dovecot.plist
    sudo launchctl load homebrew.mxcl.dovecot.plist
    
  • It does not work on the first try... so read documentation

    less /usr/local/share/doc/dovecot/documentation.txt
    less /usr/local/share/doc/dovecot/auth-protocol.txt
    less /usr/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       pam_permit.so
    account    required       pam_permit.so
    password   required       pam_deny.so
    session    required       pam_uwtmp.so
    

Comments

2012-03-16 Creating a bootable Debian USB flash drive on MacOsX

  • largely adapted from https://help.ubuntu.com/community/Installation/FromUSBStick#From_Mac_OSX

  • download the iso

    wget http://napoleon.acc.umu.se/debian-cd/6.0.4/i386/iso-cd/debian-6.0.4-i386-CD-1.iso # or http://debian.ens-cachan.fr/ftp/debian-cd/6.0.4/i386/iso-cd/debian-6.0.4-i386-xfce+lxde-CD-1.iso
    hdiutil convert -format UDRW -o target.img debian-6.0.4-i386-CD-1.iso
    mv target.img.dmg target.img
    
  • identify where is your USB stick

    diskutil list
    
  • unmount the USB stick

    diskutil unmountDisk /dev/disk2
    
  • write on the stick

    mv target.img.dmg target.img
    sudo dd if=target.img of=/dev/rdisk2 bs=1m
    
  • eject the USB stick

    diskutil eject /dev/disk2
    

Comments

2012-03-13 Moving Time Machine to a New Hard Drive

  • There exist some solution to move a time machine data folder to a new drive by making a clone of the drive. My problem is that I already have data on the new drive and that this data can difficultly be moved.

  • It try (after switching off Time machine of course) with rsync while keeping hard links:

    sudo rsync -av -H  /Volumes/tera_enigma/Backups.backupdb /Volumes/2T_un/
    
  • This takes a while as rsync has to manage a lot of them (may take also a lot of memory, so be patient)

Comments

2012-03-11 Stop Bonjour from broadcasting ssh and sftp

largely a copy-and-paste from http://hints.macworld.com/article.php?story=20070622210507844 ; Jun 25, '07 07:30:00AM • Contributed by: delight1
  • After doing a backup, edit the following file:

    sudo vim /System/Library/LaunchDaemons/ssh.plist
    
  • In the editor, the goal is to delete these two lines:

    <string>ssh</string>
    <string>sftp-ssh</string>
    
  • They should be found around lines 22 and 23. In vim, this is easily done by typing \ssh, then n until you are on the right line. Then type d2d to delete these 2 line. Finally issue wq! to save and quit.

  • Save the file and quit the editor. Then go to System Preferences » Sharing » Services, unlock it, disable Remote Login, and final re-enable Remote Login. You can check if things worked by using Bonjour Browser or some such similar app to be sure ssh/sftp no longer show up.

  • A simple grep-irbonjour/System/Library/LaunchDaemons/ gives:

    /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist:                  <key>Bonjour</key>
    /System/Library/LaunchDaemons/com.apple.bld.bulletd.plist:                      <key>Bonjour</key>
    /System/Library/LaunchDaemons/com.apple.eppc.plist:                        <key>Bonjour</key>
    /System/Library/LaunchDaemons/com.apple.FileSyncAgent.sshd.plist:                       <key>Bonjour</key>
    /System/Library/LaunchDaemons/com.apple.msrpc.echosvc.plist:                    <key>Bonjour</key>
    /System/Library/LaunchDaemons/com.apple.msrpc.echosvc.plist:                    <key>Bonjour</key>
    /System/Library/LaunchDaemons/com.apple.msrpc.lsarpc.plist:                     <key>Bonjour</key>
    /System/Library/LaunchDaemons/com.apple.msrpc.lsarpc.plist:                     <key>Bonjour</key>
    /System/Library/LaunchDaemons/com.apple.msrpc.mdssvc.plist:                     <key>Bonjour</key>
    /System/Library/LaunchDaemons/com.apple.msrpc.netlogon.plist:                   <key>Bonjour</key>
    /System/Library/LaunchDaemons/com.apple.msrpc.srvsvc.plist:                     <key>Bonjour</key>
    /System/Library/LaunchDaemons/com.apple.msrpc.srvsvc.plist:                     <key>Bonjour</key>
    /System/Library/LaunchDaemons/com.apple.msrpc.wkssvc.plist:                     <key>Bonjour</key>
    /System/Library/LaunchDaemons/com.apple.msrpc.wkssvc.plist:                     <key>Bonjour</key>
    /System/Library/LaunchDaemons/com.apple.odproxyd.plist:                 <key>Bonjour</key>
    /System/Library/LaunchDaemons/com.apple.screensharing.plist:                    <key>Bonjour</key>
    /System/Library/LaunchDaemons/com.apple.smbd.plist:                     <key>Bonjour</key>
    /System/Library/LaunchDaemons/ftp.plist:                        <key>Bonjour</key>
    /System/Library/LaunchDaemons/ssh.plist:                        <key>Bonjour</key>
    Binary file /System/Library/LaunchDaemons/telnet.plist matches
    

    so, you may want to change these too.

Comments

2012-03-10 view pdf online on firefox in macosx

  • I was dropping firefox for ohter browsers as it lacked ability to display PDFs online

  • after a loing wait, I found out pdf.js :

     pdf.js is an HTML5 technology experiment that explores building a faithful and efficient Portable Document Format (PDF) renderer without native code assistance.
    
    pdf.js is community-driven and supported by Mozilla Labs. Our goal is to create a general-purpose, web standards-based platform for parsing and rendering PDFs, and eventually release a PDF reader extension powered by pdf.js. Integration with Firefox is a possibility if the experiment proves successful.
    
  • check out: https://github.com/mozilla/pdf.js/

  • install: https://addons.mozilla.org/en-US/firefox/addon/pdfjs/

Comments