Un script shell interactif pour créer facilement une VM VirtualBox MacOS.
Les calendriers partagés Google Calendar ne sont pas synchronisés par défaut sur MacOS/IOS. Pour y accéder, il faut sélectionner explicitement les calendriers ici: https://www.google.com/calendar/syncselect
Pratique pour compresser les PDF lorsqu'on doit envoyer des documents par mail aux administrations mais que celles-ci ont des limites à 10Mb
To save storage space, you can compress a PDF in Preview.
Note: When compressed, the PDF may be of lower quality than the original.
In the Preview app on your Mac, open the PDF, then choose File > Export.
Click the Quartz Filter pop-up menu, then choose Reduce File Size.
Procedure pour installer differentes versions d'un logiciel avec brew:
$ git clone git@github.com:Homebrew/homebrew-core.git
$ cd homebrew-core
$ git log master -- Formula/terraform.rb
# retrouver le commit de la version qu'on souhaite installer
$ git checkout <commitid>
$ cd Formula
$ brew unpin terraform
$ brew unlink terraform
$ brew install terraform.rb
$ brew pin terraform
$ brew switch terraform <version>
Pour gérer les versions de Terraform, je préfère utiliser tfenv, mais la procédure est valable pour n'importe quel logiciel installable avec brew.
Le Getting Started pour utiliser Hammerspoon sur MacOS
What is Hammerspoon?
Hammerspoon is a desktop automation tool for OS X. It bridges various system level APIs into a Lua scripting engine, allowing you to have powerful effects on your system by writing Lua scripts.
C'est super puissant pour controller MacOS.
Quelques examples:
Cmd
, alt
, ctrl
et gauchehs.hotkey.bind({"cmd", "alt", "ctrl"}, "Left", function()
local win = hs.window.focusedWindow()
local f = win:frame()
local screen = win:screen()
local max = screen:frame()
f.x = max.x
f.y = max.y
f.w = max.w / 2
f.h = max.h
win:setFrame(f)
end)
Cmd
, alt
, ctrl
et droitehs.hotkey.bind({"cmd", "alt", "ctrl"}, "Right", function()
local win = hs.window.focusedWindow()
local f = win:frame()
local screen = win:screen()
local max = screen:frame()
f.x = max.x + (max.w / 2)
f.y = max.y
f.w = max.w / 2
f.h = max.h
win:setFrame(f)
end)
Cmd
, alt
, ctrl
et S
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "S", function()
hs.spotify.displayCurrentTrack()
end)
MacOS inclut /usr/libexec/java_home
pour configurer JAVA_HOME
:
export JAVA_HOME=$(/usr/libexec/java_home)
Un générateur de launchd.plist
pour executer des tâches schedulées sur MacOS.
Powershell est disponible sur macos (brew install powershell-preview
). Pratique quand a pas envie de lancer un os windows juste pour tester un bout de code powershell. Bien il n'est pas possible sur les fonctions bas niveau de powershell...
A noter que c'est aussi dispo sur la plupart des distros linux: https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux
Petit procédure pour générer une clé GPG avec Keybase sur MacOS et l'utiliser pour signer ses commits GitHub
Pour installer une appli via brew à partir d'une PR pas encore mergée dans master:
brew pull <github_pr_number>
brew install <formula_name>
Erreur rencontrée avec Ansible 2.6.5, Python 2.7.15 et MacOS 10.13 lors de l'execution d'un playbook sur un Windows 2016 Server:
$ ansible-playbook playbook.yml
PLAY [Prepare instance] *********************************************************************************************************************************************************************************************************************************************
TASK [Gathering Facts] **********************************************************************************************************************************************************************************************************************************************
Friday 05 October 2018 11:32:23 +0200 (0:00:00.072) 0:00:00.072 ********
objc[11299]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called.
objc[11299]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
^C [ERROR]: User interrupted execution
A priori c'est lié à la gestion des forks dans MacOS High Sierra. Le workaround est de faire un export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
avant de lancer Ansible
QuickLook stocke en clair une miniature de chaque fichier visualisé.
qlmanage -r cache # supprime les miniatures actuelles
qlmanage -r disablecache # désactive la mise en cache de ces miniatures
Quelques bonnes pratiques pour sécuriser MacOS.
Toutes les features d'iTerm2 en une page
Pour utiliser la font "Apple SF Mono" dans d'autres applications que Terminal.app sur MacOS
How-to pour mettre en place un Slave Jenkins sur un Mac pour builder des apps IOS depuis le Jenkins Master
10 commandes pour accélérer MacOSX en désactivant les animations superflues
Pour inverser le mapping des touches #@ et <> sur un clavier mac sous linux:
echo "echo 0 > /sys/module/hid_apple/parameters/iso_layout" >> /etc/rc.local
Comment installer Ubuntu sur MacOS X El Captain. C'est le créateur de Refind qui répond à la question. Testé et approuvé
- Boot the Ubuntu installer into "try without installing mode."
- Open a Terminal program window.
- In the Terminal, type ubiquity -b. This will run the Ubuntu installer, but -b tells it to not install a boot loader. If you follow advanced installation options, be sure to use ext4fs as your filesystem. Do not use a separate /boot partition unless you use LVM, RAID, or an encrypted root (/) partition. You may need to shrink your OS X partition to make room for Ubuntu (or you can do that before you start).
- When you're done, reboot, but hold down Command+R to boot into the OS X recovery environment.
- Launch a Terminal window and type csrutil disable to disable SIP.
- Reboot. The system should boot OS X normally.
- Install rEFInd.
Pour utiliser X11 dans un docker sur MacOS X:
brew install socat
brew cask install xquartz
open -a XQuartz
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
# in another window
# MyVBoxIP = VirtualBox IP with ifconfig vboxnet0
docker run -e DISPLAY=${MyVBoxIP}:0 jess/geary
Utilisation de Docker sur MacOS X avec Docker Machine à la place de Boot2Docker.
L'install passe par Docker Toolbox mais on peut aussi utiliser brew:
brew cask install dockertoolbox
Tuto pour installer Debian sur Mac
Comment réparer le fichier sparsebundle lorsque TimeMachine indique que celui-ci est corrompu:
chflags -R nouchg /Volumes/{name of your network share}/{name of}.sparsebundle
hdiutil attach -nomount -noverify -noautofsck /Volumes/{name of your network share/{name of}.sparsebundle
fsck_hfs -drfy -c 750 /dev/diskXs2
grep "The Volume was repaired successfully" /var/log/fsck_hfs.log
hdiutil detach /dev/diskxs2
chflags -R nouchg /Volumes/{name of your network share}/{name of}.sparsebundle
Pour étendre les fonctionnalités de la recherche Spotlight sous MacOSX.
ex: meteo/traduction/manpages/commandes shell/envoi de mails ou imessages/...
C'est OpenSource et extensible en développant des plugins en Python.
Pour contrôler Spotify depuis le centre de notifications sous MacOSX
Pour consulter l'historique de tous les fichiers téléchargés:
sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'select LSQuarantineDataURLString from LSQuarantineEvent'
Pour supprimer l'historique:
sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent'
Pour que MacOSX Yosemite cesse d'envoyer le résultat des recherches à Apple:
Disable Spotlight Suggestions and Bing Web Searches. Head to System Preferences > Spotlight > Search Results and uncheck those two boxes.
Disable Safari's Spotlight Suggestions. Head to Safari > Preferences > Search and uncheck Spotlight Suggestions.
Pour que MacOSX Yosemite cesse de sauvegarder automatiquement les documents sur le Cloud:
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
Pour ma part j'ai tout simplement désactivé iCloud Drive.
Pour configurer son Mac aux petits oignons avec Homebrew, Cask, ...
Voire aussi mon script basé sur cet article:
https://github.com/jmlrt/macosx-bootstrap
Plugin GPG pour Mail.app sur Mac OSX
Homebrew pour les binaires sur MacOSX
EDIT:
Quelques problèmes rencontrés avec Cask:
Du coup, je préfère installer les applis à la main pour pouvoir utiliser l'auto-update qu'on retrouve dans de plus en plus d'applis
Un gestionaire de package pour les logicels open source sur MacOSX
Backup the file that you’re about to patch:
sudo cp /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage /IOAHCIBlockStorage.original
Patch the file to enable TRIM support:
sudo perl -pi -e ‘s|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00).{9}(\x00\x51)|$1\x00\x00\x00\x00\x00\x00\x00\x00\x00$2|sg’ /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage
Clear the kext caches:
sudo kextcache -system-prelinked-kernel sudo kextcache -system-caches
Important: reboot your Mac!
Quelques raccourcis clavier pour MacOSX
Options au boot de Mac OSX: