The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,888 other followers

Archive for the ‘Mac OS X / OS X / MacOS’ Category

Create a custom paper size for printing on Mac – Apple Support

Posted by jpluimers on 2020/04/06

Since a search for this does not result in any hits on the apple.com web site (for instance not “To create a new paper size based on an existing size, select a paper size in the list, then click Duplicate.”), I have quoted it in full.

The main reason: “to change the name, double-click, then type a new name”

I needed this to specify A0 size, in inches, which was hard to find exact dimensions with more than 1 decimal digit, but luckily- unlike ISO 216 – Wikipedia:

And there is the millimeter specs (and way more) at [WayBack] A4 paper format / International standard paper sizes.

The quote from [WayBack/Archive.is] Create a custom paper size for printing on Mac – Apple Support:

Create a custom paper size

If you want to create a document that has a unique size, such as an envelope or card, first see if the paper size appears in the Paper Size pop-up menu. If not, you can create your own custom paper size. Custom paper sizes aren’t available for some printers or for all apps.

Note: The following options might not be available for your printer or app. If these instructions differ from what you see onscreen, refer to the documentation that came with the app you’re using.

  1. Choose File > Print. If you see a Show Details button, click it to show all available options.
  2. Click the Paper Size pop-up menu, then choose Manage Custom Sizes.
  3. Click the Add button  to add a new paper size, then specify the paper size you want.
    Click the Add button to add a new paper size. To change the name of your custom paper size, double-click the name, then type a new one. Choose a printer from the pop-up menu to use its standard margins, or enter custom values in the fields below.

To create a new paper size based on an existing size, select a paper size in the list, then click Duplicate.

To print to a custom paper size, choose it from the Paper Size pop-up menu in the Print dialog (choose File > Print). To set a document size to a custom paper size, choose it from the Paper Size pop-up menu in the Page Setup dialog (choose File > Page Setup).

Tip: If a document is printing with incorrect margins or clipped text, try this: click the Non-Printable Area pop-up menu, choose User Defined, then enter zero for the nonprintable margins. In some cases this allows the document margins to print as expected.

–jeroen

Posted in Apple, Mac OS X / OS X / MacOS, macOS 10.12 Sierra, macOS 10.13 High Sierra, Power User | Leave a Comment »

python – How do I install pip on macOS or OS X? – Stack Overflow

Posted by jpluimers on 2020/03/25

On Mac OS X with stock Python:

All you need to do is

sudo easy_install pip

After this, you might want to upgrade pip:

sudo pip install --upgrade pip

Source: [WayBackpython – How do I install pip on macOS or OS X? – Stack Overflow

You could go the homebrew way, but that means your system will have two Python installations usually causing a nightmare of path dependency orders. In addition, homebrew puts you on the wrong foot, so:

DO NOT DO THIS!

# brew install pip
Error: No available formula with the name "pip" 
Homebrew provides pip via: `brew install python`. However you will then
have two Pythons installed on your Mac, so alternatively you can install
pip via the instructions at:
  https://pip.readthedocs.io/en/stable/installing/

–jeroen

Posted in Apple, Development, Mac OS X / OS X / MacOS, macOS 10.12 Sierra, macOS 10.13 High Sierra, Power User, Python, Scripting, Software Development | Leave a Comment »

macos – Upgrade all the casks installed via Homebrew Cask – Stack Overflow

Posted by jpluimers on 2020/03/23

I missed that this was merged to master a few months ago: [WayBack] macos – Upgrade all the casks installed via Homebrew Cask – Stack Overflow:

December 2017 Update

I thought it would never happen, but there is now finally an official upgrade mechanism for Homebrew Cask (see [WayBack] Issue 3396 for the implementation)! To use it, simply run this command:

brew cask upgrade

However this will not update casks that do not have versioning information (version :latest) or applications that have a built-in upgrade mechanism (auto_updates true). To reinstall these casks (and consequently upgrade them if upgrades are available), run the upgrade command with the --greedy flag like this:

brew cask upgrade --greedy

It means you do not need manual scripts any more. So you can do without this workaround: [WayBack] GitHub – buo/homebrew-cask-upgrade: A command line tool for upgrading every outdated app installed by Homebrew Cask.

More information at [WayBack] homebrew-cask/USAGE.md at master · caskroom/homebrew-cask · GitHub: Updating/Upgrading Casks

–jeroen

Posted in Apple, Home brew / homebrew, Mac OS X / OS X / MacOS, Power User | Leave a Comment »

Mounting a Time Machine backup under Linux so you can send it to Backblaze using Restic…

Posted by jpluimers on 2020/03/16

[WayBack1/WayBack2] Memo to self: Ich will ein Time Machine Backup unter Linux mounten, um das “Latest” Verzeichnis mit Restic an Backblaze senden zu können. Schritt 1: Sp… – Kristian Köhntopp – Google+:

Memo to self: Ich will ein Time Machine Backup unter Linux mounten, um das “Latest” Verzeichnis mit Restic an Backblaze senden zu können.

Schritt 1: Sparsebundle mounten

# ls -l /export/tm_kk/
total 8
drwx—— 3 kris users 4096 Oct 21 16:24 KK.sparsebundle

Geht mit

# git clone git://github.com/torarnv/sparsebundlefs.git
# cd sparsebundlefs; make
# mkdir -p /bundles/tm_kk
# sparsebundlefs /export/tm_kk/KK.sparsebundle /bundles/tm_kk
# ls -lh /bundles/tm_kk
total 0
-r——– 1 root nogroup 1.5T Oct 21 16:24 sparsebundle.dmg

Schritt 2: DMG loopmounten

# fdisk -l /bundles/tm_kk/sparsebundle.dmg
Disk /bundles/tm_kk/sparsebundle.dmg: 1.5 TiB, 1648462135296 bytes, 3219652608 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 15FCCBBD-49E4-42BB-B359-EF662F9916CF

Device Start End Sectors Size Type
/bundles/tm_kk/sparsebundle.dmg1 40 409639 409600 200M EFI System
/bundles/tm_kk/sparsebundle.dmg2 409640 3219390423 3218980784 1.5T Apple HFS/HFS+

# kpartx -a -v /bundles/tm_kk/sparsebundle.dmg
add map loop8p1 (253:1): 0 409600 linear 7:8 40
add map loop8p2 (253:19): 0 3218980784 linear 7:8 409640

# mkdir -p /hfs/tm_kk
# mount -o ro -t hfsplus /dev/mapper/loop8p2 /hfs/tm_kk
# b=$(readlink /hfs/tm_kk/Backups.backupdb/KK/Latest)
# ls -l /hfs/tm_kk/Backups.backupdb/KK/$b
total 0
drwxr-xr-x 1 root root 30 Oct 21 14:26 ‘Macintosh HD’

Schritt 3: tmfs mount

Ein Time Machine Backup enthält doofe Hardlinks auf Verzeichnisse. Das kann Linux so nicht, und man muß das noch einmal mit tmfs fusemounten. Seufz.

# apt-get install tmfs
# mkdir -p /tmfs/tm_kk
# tmfs /hfs/tm_kk /tmfs/tm_kk
# ls -l /tmfs/tm_kk/KK/Latest/
total 0
drwxr-xr-x 1 root root 30 Oct 21 14:26 ‘Macintosh HD’

Das durchzulesen ist nicht mal langsam.

Schritt 4: Abbauen

# umount /tmfs/tm_kk
# umount /hfs/tm_kk/
# kpartx -d -v /bundles/tm_kk/sparsebundle.dmg
del devmap : loop8p1
del devmap : loop8p2
loop deleted : /dev/loop8
# umount /bundles/tm_kk

Schritt 5: Den Mist scripten

A few important comments from the WayBack2 link:

Jeroen Wiert Pluimers:

So your time machine data is on a Linux disk that you export from Linux to MacOS? (as otherwise, I don’t understand what /export/tm_kk/KK.sparsebundle is for)

Kristian Köhntopp:

Yes, I am running netatalk, SMB and NFS on an Ubuntu 18.04.

Jeroen Wiert Pluimers:

+Kristian Köhntopp Thanks. What do you envision as steps to restore a complete time machine?

Kristian Köhntopp:

We will see. I do not see that as normally necessary. Mostly I do not want to lose the work on my laptop, and am just to lazy to restrict the backup to that. In general, it should be possible to create this as a writeable setup so that I get the data back. I will probably never recreate a full runnable mac setup from this emergency offsite backup.

Tools used:

–jeroen

Posted in *nix, *nix-tools, Apple, Backup, Mac, Mac OS X / OS X / MacOS, MacBook, Power User | Leave a Comment »

MacOS: Checking a disk for bad blocks

Posted by jpluimers on 2020/03/13

Hardware fails, but most disk tools on MacOS only check logical disk structures, not bad blocks.

Luckily, fsck_hfs can, though Apple is a bit secretive on it: [WayBack] Page Not Found – Apple Developer: ManPages/man8/fsck_hfs.8.html is empty, but there is [WayBack] man page fsck_hfs section 8 and the gist below.

Disk volumes on MacOS use a successor of HFS called HFS Plus – Wikipedia, but the tooling never changed names.

I got at the below parameters through [

This is the disk check command:

# sudo fsck_hfs -dylS /dev/disk3s1
** /dev/rdisk3s1 (NO WRITE)
    Using cacheBlockSize=32K cacheTotalBlock=65536 cacheSize=2097152K.
Scanning entire disk for bad blocks
   Executing fsck_hfs (version hfs-407.50.6).
** Performing live verification.
** Checking Journaled HFS Plus volume.
   The volume name is SanDisk400GB
** Checking extents overflow file.
** Checking catalog file.
** Checking extended attributes file.
** Checking volume bitmap.
** Checking volume information.
** The volume SanDisk400GB appears to be OK.
    CheckHFS returned 0, fsmodified = 0

The italic part is the bad block scanning. The normal part the hfs scanning, which will continue even after finding bad blocks.

If bad blocks are found, output looks more like on the right. If it looks like that, basically you know a disk is toast.

It can be slow, as I did not specify a cache, so it defaults to 32 Kibibyte. You can increase that by adding for instance -c 512m  for 512 Mebibyte cache, just read the short help or man page below.

This tremendously helps checking volumes containing many files, for instance [WayBack] Checking Very Large Time Machine Volumes – Mac OS X Hints

Read the rest of this entry »

Posted in Apple, Mac, Mac OS X / OS X / MacOS, Power User | Leave a Comment »

 
%d bloggers like this: