« MACOSX » : différence entre les versions
| (101 versions intermédiaires par le même utilisateur non affichées) | |||
| Ligne 4 : | Ligne 4 : | ||
== Envoyer un email par php sous Mac OS X == | == Envoyer un email par php sous Mac OS X == | ||
* https://j2c.org/informatique/linux/postfix_relay.php | |||
* https://gist.github.com/loziju/66d3f024e102704ff5222e54a4bfd50e | |||
* https://appletoolbox.com/seeing-error-operation-not-permitted-in-macos-mojave/ | |||
usage: postfix start (or stop, reload, abort, flush, check, status, set-permissions, upgrade-configuration) | usage: postfix start (or stop, reload, abort, flush, check, status, set-permissions, upgrade-configuration) | ||
* postfix | * postfix | ||
<pre> | <pre> | ||
- 1 sudo nano /etc/postfix/main.cf | |||
relayhost=smtp.gmail.com:587 | relayhost=smtp.gmail.com:587 | ||
smtp_sasl_auth_enable=yes | smtp_sasl_auth_enable=yes | ||
| Ligne 18 : | Ligne 23 : | ||
tls_random_source=dev:/dev/urandom | tls_random_source=dev:/dev/urandom | ||
- 2 sudo nano /etc/postfix/sasl_passwd | |||
smtp.gmail.com:587 user:password | smtp.gmail.com:587 user:password | ||
- 3 Générer le fichier .db nécessaire au bon fonctionnement de postfix | |||
< | |||
postmap /etc/postfix/sasl_passwd | |||
- 4 Autorun postfix on boot and restart postfix | |||
Copy the postfix master plist out of System folder. | |||
sudo cp /System/Library/LaunchDaemons/com.apple.postfix.master.plist /Library/LaunchDaemons/org.postfix.custom.plist | |||
sudo vi /Library/LaunchDaemons/org.postfix.custom.plist | |||
Change the label value from com.apple.postfix.master to org.postfix.custom | |||
Remove these lines to prevent exiting after 60s | |||
<string>-e</string> | |||
<string>60</string> | |||
Add these lines before </dict> | |||
<key>KeepAlive</key> | |||
<true/> | |||
<key>RunAtLoad</key> | |||
<true/> | |||
Relaunch the daemon. | |||
sudo launchctl unload /Library/LaunchDaemons/org.postfix.custom.plist | |||
sudo launchctl load /Library/LaunchDaemons/org.postfix.custom.plist | |||
''security System Integrity Protection (SIP) | |||
démarrer le mac en recovery Pomme-R | |||
Temporarily Turn Off Your Mac’s System Integrity Protection (Recommended For Advanced Users Only!) | |||
Restart in Recovery Mode (press and hold Command + R at startup) | |||
Open the Terminal Utility | |||
Type the command csrutil disable | |||
This gives you full, unrestricted access to your Mac’s entire operating system and every file–so again, advanced users only | |||
For Terminal Users; | |||
Restart your Mac and open Terminal again | |||
Use Terminal with the commands that resulted in operation not permitted errors | |||
When done, follow steps 1-2 and turn SIP back on using the command csrutil enable | |||
Restart your Mac and SIP should be back in business'' | |||
- 4 relancer postfix | |||
sudo postfix stop | sudo postfix stop | ||
sudo postfix load | sudo postfix load | ||
5 - Test | |||
echo "Test sending email from Postfix" | mail -s "Test Postfix" youremail@domain.com | |||
Change youremail@domain.com with valid email with mailbox access for easy checking. | |||
Check mail queue and possible delivery errors with mailq. | |||
Check mail log with tail -f /var/log/mail.log. | |||
</pre> | </pre> | ||
| Ligne 67 : | Ligne 119 : | ||
</pre> | </pre> | ||
* MySql | |||
<pre> | |||
brew services restart mariadb | |||
si il y a de nombreuses bases et de tables il faut augmenter limit.maxfiles du mac | |||
verifier avec | |||
$ ulimit -n | |||
et | |||
$ ulimit -u | |||
- create /Library/LaunchDaemons/limit.maxfiles.plist | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |||
<plist version="1.0"> | |||
<dict> | |||
<key>Label</key> | |||
<string>limit.maxfiles</string> | |||
<key>ProgramArguments</key> | |||
<array> | |||
<string>launchctl</string> | |||
<string>limit</string> | |||
<string>maxfiles</string> | |||
<string>524288</string> | |||
<string>524288</string> | |||
</array> | |||
<key>RunAtLoad</key> | |||
<true/> | |||
<key>ServiceIPC</key> | |||
<false/> | |||
</dict> | |||
</plist> | |||
- create /Library/LaunchDaemons/limit.maxproc.plist | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE plist PUBLIC "-//Apple/DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |||
<plist version="1.0"> | |||
<dict> | |||
<key>Label</key> | |||
<string>limit.maxproc</string> | |||
<key>ProgramArguments</key> | |||
<array> | |||
<string>launchctl</string> | |||
<string>limit</string> | |||
<string>maxproc</string> | |||
<string>2048</string> | |||
<string>2048</string> | |||
</array> | |||
<key>RunAtLoad</key> | |||
<true /> | |||
<key>ServiceIPC</key> | |||
<false /> | |||
</dict> | |||
</plist> | |||
</pre> | |||
* PHP | * PHP | ||
brew services restart php72 | brew services restart php72 | ||
brew services restart php@5.6 | |||
* avec PHP 5.6 | |||
<nowiki> | |||
These steps worked on my Mac, Catalina version 10.15.3 (19D76). | |||
Step 1: Tap deprecated brew formula | |||
brew tap exolnet/homebrew-deprecated | |||
Step 2: Install PHP 5.6 | |||
brew install php@5.6 | |||
You can also have PHP 7.2 just run | |||
brew install php@7.2 | |||
Step 3: Install PHP switcher script to switch between 5.6 and 7.2 | |||
$ curl -L https://gist.githubusercontent.com/rhukster/f4c04f1bf59e0b74e335ee5d186a98e2/raw > /usr/local/bin/sphp | |||
$ chmod +x /usr/local/bin/sphp | |||
If you run sphp 7.2 it should work but running sphp 5.6 will not work and will show error like this from apache. | |||
Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylibn Referenced from: /usr/local/opt/php@5.6/lib/httpd/modules/libphp5.son Reason: image not found | |||
Unless we switch openssl version, it wont work. So we have to install old openssl | |||
Step 4: Install old openssl | |||
brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb | |||
Step 5: Switch to openssl 1.0 | |||
brew switch openssl 1.0.2t | |||
Now you switch to PHP 5.6 by | |||
sphp 5.6 | |||
Everything works. | |||
! attention appliquer le patch | |||
</nowiki> | |||
[https://github.com/eXolnet/homebrew-deprecated/issues/23 PATCH PHP 5.6 Catalina (JParkinson1991 commented)] | |||
These open issues may also help: | |||
[https://github.com/eXolnet/homebrew-deprecated/issues/23 php@5.6 Library not loaded libicui18n.64.dylib] | |||
[https://github.com/eXolnet/homebrew-deprecated/issues/19 MacOs, brew install exolnet/deprecated/php@5.6 errors] | |||
[https://github.com/eXolnet/homebrew-deprecated/issues/14 PHP 5.6 and 7.0 doesn't run on Catalina - openssl 1.0.0 needed] | |||
[https://github.com/eXolnet/homebrew-deprecated/pull/25 Adds optional openssl@1.1 compatability patch for php@5.6.] | |||
source: | |||
* https://www.sminrana.com/php/install-php-5-6-on-macos-catalina/ | |||
* avec PHP-FPM | |||
* https://www.aritsltd.com/blog/server/configuring-apache-with-php7-fpm-on-macos-mojave-using-homebrew/ | |||
* https://medium.com/@fahimhossain_16989/configuring-apache-with-php7-fpm-for-mac-os-x-using-homebrew-54a26bbdac7c | |||
* Redemarrer php | |||
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php@7.2.plist | |||
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.php@7.2.plist | |||
== Setup PHP == | == Setup PHP == | ||
| Ligne 121 : | Ligne 284 : | ||
http://liondiskmaker.com | http://liondiskmaker.com | ||
[[category:softz]] | == clear DNS cache == | ||
sudo killall -HUP mDNSResponder; sleep 2; | |||
== changer hostname == | |||
sudo scutil --set HostName "nouveaunom" | |||
sudo scutil --set ComputerName "nouveaunom" | |||
sudo scutil --set LocalHostName "nouveaunom" | |||
* https://www.macplanete.com/astuces/30390/changer-le-nom-de-son-mac | |||
== Volumes == | |||
autofs automounter | |||
*[https://useyourloaf.com/blog/using-the-mac-os-x-automounter/ Using the Mac OS X automounter] | |||
=== créer un répertoire de montage === | |||
<pre> | |||
/Users/user1/Nas/airdisk ou /System/Volumes/Data/Users/user1/Nas/airdisk | |||
/Users/user2/Nas/airdisk2 ou /System/Volumes/Data/Users/user2/Nas/airdisk | |||
</pre> | |||
ls -la | |||
dr-xr-xr-x root wheel mnt | |||
=== créer des fichiers de ressources pour automount === | |||
/etc/auto_airdiskuser1 | |||
exemples de partages: | |||
<pre> | |||
Data -fstype=smbfs ://user:password@nas._smb._tcp.local/Data | |||
photo -fstype=smbfs ://user:password@nas._smb._tcp.local/photo | |||
video -fstype=smbfs ://user:password@nas._smb._tcp.local/video | |||
music -fstype=smbfs ://user:password@nas._smb._tcp.local/music | |||
download -fstype=smbfs ://user:password@nas._smb._tcp.local/download | |||
</pre> | |||
/etc/auto_airdiskuser2 | |||
exemples de partages: | |||
<pre> | |||
Data -fstype=smbfs ://user:password@nas._smb._tcp.local/Data | |||
toto -fstype=smbfs ://user:password@nas._smb._tcp.local/toto | |||
</pre> | |||
=== modifier le fichier master pour automount === | |||
/etc/auto_master | |||
Chaque utilisateur a son partage. | |||
<pre> | |||
# | |||
# Automounter master map | |||
# | |||
/System/Volumes/Data/Users/user1/Nas/airdisk auto_airdiskuser1 | |||
/System/Volumes/Data/Users/user2/Nas/airdisk auto_airdiskuser2 | |||
+auto_master # Use directory service | |||
#/net -hosts -nobrowse,hidefromfinder,nosuid | |||
/home auto_home -nobrowse,hidefromfinder | |||
/Network/Servers -fstab | |||
/- -static | |||
</pre> | |||
=== exécuter les changements === | |||
sudo automount -vc | |||
=== démonter les volumes === | |||
sudo umount /Users/user1/Nas/airdisk | |||
=== découvrir les options du point de montage === | |||
mount | grep airdisk | |||
=== qu'est ce qui fonctionne ? === | |||
<pre> | |||
ps -ef | grep automount | grep -v grep | |||
ps -ef | grep autof | grep -v grep | |||
</pre> | |||
=== cd dans le repertoire = montage automatique === | |||
cd /System/Volumes/Data/Users/user1/Nas/airdisk/Data | |||
df -Ph . | |||
== astuces == | |||
=== désactiver temporairement la mise en veille d'OS X === | |||
Pour couper provisoirement la veille d'OS X | |||
<code>caffeinate -di</code><br> | |||
L'ordinateur restera alors en éveil tant que le Terminal sera ouvert, et ni le système ni l'écran n'entreront en mode économie d'énergie. <br> | |||
Pour retrouver un comportement normal, il suffira de fermer le Terminal ou de désactiver la commande à l'aide du raccourci « Control-C ». | |||
Si toutefois vous ne souhaitez pas laisser le mode « Caffeinate » indéfiniment, il est possible de définir <br> | |||
à l'avance la durée pendant laquelle l'ordinateur échappera à la veille. Il suffit pour cela d'ajouter à la fin<br> | |||
de la commande précédente le temps (en secondes) pendant lequel cette dernière restera active, et en remplaçant la particule « di » par « dt ». | |||
Pour activer le mode « Caffeinate » pendant deux heures, il faudra ainsi saisir la commande suivante dans le Terminal : | |||
<code>caffeinate -dt 7200</code> | |||
source : [https://www.mackungfu.org/20-classic-mac-tips-and-tricks-you-don-t-know mackungfu.org] | |||
[[category:softz]] [[category:MAC]] | |||