Apple OSX

From HaFrWiki
(Redirected from Search Apple Email Rules)
Jump to: navigation, search

The goal of this page is to give information on OSX and related issues.

Is that necessary? Yes, because Apple products have a lot of hidden features!

Apple/Unicode Characters

How to get the correct Apple tokens/sign/characters for typical computer operations.
For more tokens and their character representation look at HarmFrielink Unicode characters.
There are also links to more sites with characters and their representation.


Token Description Code
Apple 
Escape ⎋
Tab left/backward &#x21e4
Tab right/forward ⇥
Caps lock ⇪
Shift ⇧
Control (ctrl) ⌃
Option (alt) ⌥
Command ⌘
Space ␣
Return ⏎
 
Token Description Code
Enter ↩
Backspace ⌫
Delete ⌦
? Help ⌦
Help ⃝
Home &x21f1;
Home &x2196;
Home &x21b8;
End &x21f2;
End &x2198;
Page Up &x21de;
 
Token Description Code
Page Up &x21df;
Arrow Up &x21e1;
Arrow Down &x2193;
Arrow Left &x2190;
Arrow Left &x21e0;
Arrow Right &x2190;
Arrow Right &x21e2;
Clear &x2327;
Num Lock &x21ed;
Eject &x23cf;
Power &x233d;

Disk Access

Apple OSX can read form a lot of disk-formats, but can not write to them. First problem, windows NTFS.

Tuxera

Mac OS X does not support writing to Microsoft Windows formatted NTFS volumes out-of-the box. The solution is here. Tuxera [1] NTFS for Mac is our commercial read/write NTFS software for Mac users. Tuxera NTFS for Mac delivers the fastest NTFS data transfer speeds you can have on Mac while protecting your data with its new, smart caching layer.

The software fully supports all versions of Mac OS X from 10.4 (Tiger) onwards, including of course Mac OS X 10.8 (Mountain Lion) with its 64-bit kernel, and comes with advanced features only available from Tuxera such as support for NTFS extended attributes. Tuxera NTFS for Mac is compatible with popular virtualization and encryption solutions including Parallels Desktop®, VMware Fusion® and TrueCrypt.

Email

If you have more than 1 email address (who hasn't), you probably have the problem that when sending an email the wrong email account is selected in Apple mail.

On the internet there are some suggestions how to change this in older version of OSX,
but the following method will work for OSX Lion 10.8.2.

  • Start mail

In this example the HF One needs to be the first mailbox.

  • Click the command key (⌘) and click and hold the Left-Mouse on
    the HF One icon or HF One-text and drag it above the iCloud
  • Release mouse and command key when the correct position is reached.

This should endup with HF One above iCloud.
That's it.

Apple Mailbox

Email Sync Multiple Devices

If you are using the same email account on multiple devices, the send-emails are only stored on the device that has sent the email [2].
That's not always what you want. Suppose:

  • Send email to someone from your macbook-pro and you can not find the sent mail on your iMac which has the full-copy of the mailbox.
  • The sent mail is stored in the inbox/sentmail of your mailbook-pro.

You can prevent this behaviour by sending a copy of the sent mail using the BCC-option.
And that can be done automatically! How:
Open terminal <syntaxhighlight lang="bash" line>

  1. First check if there is already an email-bcc-rule active.

$ defaults read com.apple.mail UserHeaders. 2018-08-11 12:27:58.107 defaults[37344:8567991] The domain/default pair of (/Users/HaFrMpro/Library/Containers/com.apple.mail/Data/Library/Preferences/com.apple.mail, UserHeaders.) does not exist

  1. Now add the bcc you want to use

$ defaults write com.apple.mail UserHeaders '{"Bcc" = "xxx@harmfrielink.nl"; }' /Sources/GitLab/PHP-Web-Start/src:HaFrMpro$ defaults read com.apple.mail UserHeaders {

   Bcc = "xxx@harmfrielink.nl";

} </syntaxhighlight> Optional you can change the mail-signature of the devices so you can find the sending-device of the email.

Email Signature

One of the toughest things to make is a nice signature in Apple Email. The cause comes of the complicated way mail is handling the HTML code insight the mail.
See for more how to do it on : http://mydesignpad.com/create-a-html-email-signature-for-mac-os-x-mountain-lion-10-8/.
An excerpt of all the steps:

  • Step 1: Designing the HTML/CSS
  • Step 2: Create Placeholder Signature in Mail
  • Step 3: Open the Signatures Folder
  • Step 4: Update Placeholder Signature
  • Step 5: Lock Updated Signature File – Important Step!
  • Step 6: Check Installation

Finder

Zichtbaar maken van UNIX systeem mappen. OS X is gebaseerd op UNIX, waardoor het mogelijk is om UNIX programma’s te draaien.

Omdat UNIX het belangrijkste deel van de systeemlaag is zijn er enkele systeembestanden in de Finder onzichtbaar gemaakt om fouten of beschadiging aan het systeem te vermijden.

Maar heb je deze bestanden en mappen een keer nodig dan kan je deze simpelweg activeren doormiddel van een command in de terminal uit te voeren.

Nota Bene: Het zichtbaar maken van deze bestanden zijn geheel op eigen risico bij fouten kan het systeem compleet niet meer werken!

  defaults write com.apple.Finder AppleShowAllFiles TRUE

Om de wijzigingen door te voeren dien je de Finder te herstarten, doormiddel van het Apple menu via Forceer Stop of een terminal command:

  killall Finder

Hierdoor is het nu mogelik belangrijke systeemmappen zichtbaar te maken en te gebruiken.
Wijzigingen zijn terug te draaien door het omgekeerde TRUE naar FALSE te wijzigingen in de terminal.

  defaults write com.apple.Finder AppleShowAllFiles FALSE

Na de wijziging dien je de Finder te herstarten.

  killall Finder

Nu zijn alle instellingen weer naar behoren en zal je geen belangrijke systeem mappen meer zien

Search Email Rules

Solution for Apple OSX 10.8.1 (Lion).
The location of the mailbox rules: ~/Library/Mail/V2/MailData/MessageRules.plist
Open the file with your favourite editor and search for the item your looking for.

The name of the rules is defined in the XML-tags:

     <key>RuleName</key>
     <string>Name-of-the-Rule</string>


Be careful not to make changes in this file directly, cause this may damage your rules!!

Login Items

The Apple Login Items (System Settings and Search for it) enables the automatic startup of applications.
However sometimes you ma wanna have an application to be started after a certain delay (because you need another app to be up-and-running before.
The following basic script is a basic framework to do so.

#!/bin/bash
# Wait for however long you want:
sleep <num of seconds>

# Use the following if the program is a .app:
open -a /path/to/app/myApp.app

# Use the following if the program is an executable (not a .app):
/path/to/exec/theExec
  • Save the file to your documents folder as startupScript.bash.
  • Open a Terminal and Type
chmod +x ~/Documents/startupScript.bash
  • Open System Preferences, and add the script to the login items tab.

Maintenance OSX

All the scripts can be packed into a UI-service. One of them is MacPaws Clean My Mac. Here are the core OSX functions that are doing the tricks.

Free Up RAM

Mac OS X has fairly good memory management but it’s not perfect, and sometimes RAM can be held unnecessarily in the “inactive” state despite the contents no longer being needed.
To free inactive space open terminal: <syntaxhighlight lang="bash" >

  1. Frees inactive memory

$ sudo purge </syntaxhighlight>

  • MacPaw, Howto reduce memory usage on Mac.

Flush DNS Cache

<syntaxhighlight lang="bash" line start="1">

  1. For OS X 12 (Sierra) and later:

$ sudo killall -HUP mDNSResponder ; sleep 2; sudo killall mDNSResponderHelper ; sudo dscacheutil -flushcache

</syntaxhighlight>

  • MacPaw, Clear DNS cache on Mac.

Run Maintenance Scripts

You can use 3rd party software to run maintenance scripts (see above), but you can also do them manually using the OSX function periodic which require sudo rights.

<syntaxhighlight lang="bash" line start="1">

  1. How to check when maintenance scripts were last run

$ ls -al /var/log/*.out -rw-r--r-- 1 root wheel 1112623 Sep 12 07:14 /var/log/daily.out -rw-r--r-- 1 root wheel 14475 Sep 11 07:04 /var/log/monthly.out -rw-r--r-- 1 root wheel 19539 Sep 11 07:04 /var/log/weekly.out </syntaxhighlight> If the logs are showing that your maintenance scripts haven’t been run for a while, it’s recommended that you run a manual script.

  • MacPaw, How to run maintenance scripts on OSX.

<syntaxhighlight lang="bash" line start="1">

  1. How to Run Maintenance Scripts through Terminal

$ sudo periodic daily weekly monthly Password:? </syntaxhighlight> Enter your password.
All three scripts will run in sequence. There is no visual feedback while the scripts execute. You will know they are completed when the Terminal prompt returns.

Explanation

The daily script removes old log files, "scratch" and "junk" files, backs-up the NetInfo database (Mac OS X 10.4 Tiger® and earlier), reports a variety of system and network statistics, and rotates the system.log file.

  • Under Tiger, the daily script also cleans up scratch fax files and prunes asl.log, the log file for the then-new Apple System Logging facility.
  • Under Mac OS X 10.5 Leopard®, the daily script also prunes the asl.db file that replaced the asl.log file for Apple System Logging.
  • The output from the daily script is written to the /var/log/daily.out file, which can be viewed in Console.
  • By default, the daily script is scheduled to run daily at 03:15 hours local time.

The weekly script rebuilds the locate and whatis databases.

  • Depending on the version of Mac OS X, it also rotates the following log files: ftp.log, lookupd.log, lpr.log, mail.log, netinfo.log, ipfw.log, ppp.log, and secure.log
  • The output from the weekly script is written to the /var/log/weekly.out file, which can be viewed in Console.
  • By default, the weekly script is scheduled to run every Saturday at a specific time. Under Tiger and later, it runs at 03:15 hours local time. Under Mac OS X 10.3 Panther® and Mac OS X 10.2 Jaguar it runs at 04:30 hours local time.

The monthly script reports per-user usage accounting and rotates — depending on the version of Mac OS X — the wtmp, install.log, and cu.modem.log files.

  • The output from the monthly script is written to the /var/log/monthly.out file, which can be viewed in Console.
  • By default, the monthly script is scheduled to run on the first of the month at 05:30 hours local time.

Repair Disk permissions

Because as of macOS version 10.11 El Capitan, Disk Utility no longer comes with the option "repair disk permissions". Boooo!
Apple even removed the command line: <syntaxhighlight lang="bash">

  1. Deprecated command is OSX 12

$ sudo /usr/libexec/repair_packages –verify –standard-pkgs/ </syntaxhighlight> But there’s a method to the madness. macOS now comes with a feature called System Integrity Performance (SIP) which is designed to automatically repair file permissions during software updates and system changes.
Anyway, back to using Disk Utility to repair disk permissions. If you’re running a pre-El Capitan version of macOS, follow these steps:

  1. Press Command + Space to open Spotlight, type in “Disk Utility”, and hit Enter.
  2. Select Macintosh HD from the left sidebar menu.
  3. Click on the First Aid tab.
  4. Click on Verify Disk Permissions.
    • By taking this step, Disk Utility will work through your hard drive to detect broken or misbehaving permissions and list them for repair.
    • This might take a few minutes but you can check the Show details box to keep an eye on its progress.
  5. Click on Repair Disk Permissions and wait while Disk Utility runs through the identified permissions to fix them.
  • MacPaw, How to repair disk permissions.

Monitor your Mac

Monitor your Mac gives you a list of powerful and useful terminal UNIX commands to see the health and performance of your OSX device [3].

Top

The UNIX command top is an equivalent of the Activity Monitor with some slight differences. <syntaxhighlight lang="bash">

  1. Opens the top window sorted on CPU and 5 seconds update.

$ top -o cpu -s 5 </syntaxhighlight>

Top command OSX Activity Monitor
Top
OSX-ActivityMonitor.png

List open files

The lsof command used in many Linux/Unix like system that is used to display list of all the open files and the processes.
The open files included are disk files, network sockets, pipes, devices and processes.
One of the main reason for using this command is when a disk cannot be unmounted and displays the error that files are being used or opened.
With this command you can easily identify which files are in use.
The most common format for this command is.

<syntaxhighlight lang="bash">

  1. List all Open Files with lsof Command

$ lsof COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME perl5.18 86 frielink1 cwd DIR 1,8 1496 171171422 /Library/PreferencePanes/Squeezebox.prefPane/Contents/server perl5.18 86 frielink1 txt REG 1,8 52864 183544244 /usr/bin/perl5.18 perl5.18 86 frielink1 txt REG 1,8 2505568 183422594 /System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/libperl.dylib .... perl5.18 86 frielink1 1u REG 1,8 45133 185875296 /Users/frielink1/Library/Logs/Squeezebox/server.log </syntaxhighlight>

FD – stands for File descriptor and may seen some of the values as:
  • cwd current working directory
  • rtd root directory
  • txt program text (code and data)
  • mem memory-mapped file
Also in FD column numbers like 1u:
  • r for read access.
  • w for write access.
  • u for read and write access.
TYPE – of files and it’s identification.
  • DIR – Directory
  • REG – Regular file
  • CHR – Character special file.
  • FIFO – First In First Out

List all users files

<syntaxhighlight lang="bash">

  1. List all users file

$ lsof -u frielink1 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME perl5.18 86 frielink1 cwd DIR 1,8 1496 171171422 /Library/PreferencePanes/Squeezebox.prefPane/Contents/server perl5.18 86 frielink1 txt REG 1,8 52864 183544244 /usr/bin/perl5.18 perl5.18 86 frielink1 txt REG 1,8 2505568 183422594 /System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/libperl.dylib perl5.18 86 frielink1 txt REG 1,8 43792 183422795 /System/Library/Perl/5.18/darwin-thread-multi-2level/auto/Cwd/Cwd.bundle


  1. List Only IPv4 & IPv6 Open Files

$ lsof -i 4 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME perl5.18 86 frielink1 9u IPv4 0xeafb4cd1924121c9 0t0 UDP *:slim-devices perl5.18 86 frielink1 10u IPv4 0xeafb4cd190abe809 0t0 TCP *:slim-devices (LISTEN) perl5.18 86 frielink1 25u IPv4 0xeafb4cd190ab9d89 0t0 TCP *:websm (LISTEN)


  1. List Open Files of TCP Port ranges 1-1024

$ lsof -i TCP:1-1024


  1. Exclude User with ‘^’ Character

$ lsof -i -u^root COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME perl5.18 86 frielink1 9u IPv4 0xeafb4cd1924121c9 0t0 UDP *:slim-devices perl5.18 86 frielink1 10u IPv4 0xeafb4cd190abe809 0t0 TCP *:slim-devices (LISTEN) perl5.18 86 frielink1 25u IPv4 0xeafb4cd190ab9d89 0t0 TCP *:websm (LISTEN) perl5.18 86 frielink1 28u IPv4 0xeafb4cd192c501c9 0t0 UDP *:61744 perl5.18 86 frielink1 29u IPv6 0xeafb4cd192c4f9d1 0t0 UDP *:* </syntaxhighlight>

Safari

Always looking for the quick-key for moving between the different open Safari-windows? what about Command-Tilde (⌘-`).

JavaScripts

When you are debugging JavaScript, you will find some installed javascripts from Safari. They are located in the directory:

  • /Users/<your-user-name>/Library/Caches/com.apple.Safari/Extensions

Examples are:

  • ../iTube Studio.safariextension/analysismodule/website_extract.js
  • ../Exposer.safariextension/inject.js

See also

top

Reference

top

  1. Tuxera, NTFS for Mac.
  2. LifeWire Automatically bcc osx mail
  3. TecMint Command line tools to monitor LINUX performance.