Tag Archives: macOS

Hardcoded Folder Icons in macOS

I saw this post on Mastodon, and it got me thinking.

Screenshot 2023 02 08 at 4 26 58 AM

Are there any other hardcoded folder names in macOS? Where would I even start looking?

Well, based on what I know, every program on macOS is a directory that ends with .app, which means all I have to do is to find Finder’s location.

That should be pretty easy!

antranigv@zvartnots:~ $ cd /System/
antranigv@zvartnots:/System $ find . -type d -name Finder.app 2>/dev/null
./Library/CoreServices/Finder.app
./Volumes/Data/System/Library/CoreServices/Finder.app

Well, that was easy to find! Don’t worry, /System/Library is the same as /System/Volumes/Data/System/Library, Apple has a weird way of doing mount points, and I’m not here to judge. Well, at least not today!

Next I have to dig into Finder.app’s content, let’s see what we have.

antranigv@zvartnots:/System $ cd Library/CoreServices/Finder.app/
antranigv@zvartnots:/System/Library/CoreServices/Finder.app $ find . -type f -name 'Developer*'

Weird. Nothing at all?

I wonder what type of files we have here? I already know that I wanna see all the file types except Mach-O.

$ find . -type f -print0 | xargs -0 -I% -L 1 file -b "%" | sort -u | grep -v 'Mach-O'
ASCII text, with no line terminators
Apple binary property list
IFF data, AIFF audio
Mac OS X Code Directory version 20100 - 203 bytes
Mac OS X Code Directory version 20100 - 213 bytes
Mac OS X Code Directory version 20100 - 215 bytes
Mac OS X Code Directory version 20100 - 217 bytes
Mac OS X Code Requirement Set - 76 bytes
Mac OS X Code Requirement Set - 84 bytes
Mac OS X Code Requirement Set - 88 bytes
Mac OS X bill of materials (BOM) file
Mac OS X icon, 114423 bytes, "ic13" type
Mac OS X icon, 1162872 bytes, "ic12" type
Mac OS X icon, 23712 bytes, "ic13" type
Mac OS X icon, 30805 bytes, "ic13" type
Mac OS X icon, 37834 bytes, "ic13" type
Mac OS X icon, 72729 bytes, "ic13" type
Mac OS X icon, 76602 bytes, "ic13" type
XML 1.0 document text, ASCII text
XML 1.0 document text, Unicode text, UTF-8 text
data

Okay! we’re getting somewhere!

According to Magic file directory on FreeBSD, the filename is usually .icns

I think the rest will be easy, let’s try this again!

$ find /System/Library -type f -name 'Developer*.icns' 2>/dev/null
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/DeveloperFolderIcon.icns

Bingpot!

What else do we have there?

$ find . -type f -name '*Folder*.icns'
./UsersFolderIcon.icns
./DocumentsFolderIcon.icns
./SidebarHomeFolder.icns
./ApplicationsFolderIcon.icns
./PrivateFolderBadgeIcon.icns
./GenericFolderIcon.icns
./PicturesFolderIcon.icns
./SidebarDesktopFolder.icns
./PublicFolderIcon.icns
./SidebarGenericFolder.icns
./SystemFolderIcon.icns
./ServerApplicationsFolderIcon.icns
./LibraryFolderIcon.icns
./ReadOnlyFolderBadgeIcon.icns
./SidebarBurnFolder.icns
./OpenFolderIcon.icns
./SmartFolderIcon.icns
./BurnableFolderIcon.icns
./SidebarDownloadsFolder.icns
./SidebarMoviesFolder.icns
./SidebarPicturesFolder.icns
./UtilitiesFolder.icns
./SidebarSmartFolder.icns
./HomeFolderIcon.icns
./SidebarApplicationsFolder.icns
./MovieFolderIcon.icns
./SidebarDocumentsFolder.icns
./DropFolderBadgeIcon.icns
./DownloadsFolder.icns
./GroupFolder.icns
./SidebarUtilitiesFolder.icns
./SidebarMusicFolder.icns
./DeveloperFolderIcon.icns
./NewFolderBadgeIcon.icns
./MusicFolderIcon.icns
./DesktopFolderIcon.icns
./SitesFolderIcon.icns
./SidebarDropBoxFolder.icns

These are good! Let’s look at them!

I wrote a script that converts all these .icns files to proper PNGs using the iconutil program.

#!/bin/sh

for icns in *.icns;
do
  iconutil -c iconset "${icns}"
done

for iconset in *.iconset;
do
  cp "${iconset}/icon_512x512@2x.png" "${iconset}-icon_512x512@2x.png" ||
    cp "${iconset}/icon_32x32.png" "${iconset}-icon_32x32.png"
done

Here are the ones that we see basically every day!

Here are some of the exotic ones that we don’t always notice, in an alphabetical order.

The Burnable folder! Still supported even on macOS Ventura!

BurnableFolderIcon iconset icon 512x512 2x

The Developer folder! If you don’t know where you should put your code, this is the right place for it!

DeveloperFolderIcon iconset icon 512x512 2x

The Group folder!

GroupFolder iconset icon 512x512 2x

The Library!

LibraryFolderIcon iconset icon 512x512 2x

The Public folder! Want to share something with your local network? Put it here!

PublicFolderIcon iconset icon 512x512 2x

The Server Applications Folder! Wait, what? I’ve never seen this before. If you know what this is, please leave a reply 🙂

ServerApplicationsFolderIcon iconset icon 512x512 2x

The Sites folder! If you’re new to macOS, this is a kindly reminder that macOS ships with Apache2. Yes, and ~/Sites is the default UserDir, i.e. http://localhost/~yourusername

$ grep '^UserDir' /etc/apache2/extra/httpd-userdir.conf 
UserDir Sites

SitesFolderIcon iconset icon 512x512 2x

The System folder!

SystemFolderIcon iconset icon 512x512 2x

The User folder!

UsersFolderIcon iconset icon 512x512 2x

And finally… the Utilities folder which lives inside the Application folder!

UtilitiesFolder iconset icon 512x512 2x

As sad as it is, these are the old icons, i.e. pre-Ventura (I think). I wish if there was a way to click on a switch and change it back, since it’s all here anyway!

That’s all folks…

Reply via email.

Apple updated macOS’s date(1)!

In 2020 I blogged that

[…] macOS is becoming less Unix-y every year, date(1) is outdated […]

While I was coding, I thought that I’m (SSH’d to) on my FreeBSD machine but I was on macOS, I noticed that the -I flag suddenly works.

I wondered if Apple has updated the date(1) command in macOS Ventura.

Luckily, I have macOS Monterey at home as well.

Here’s the date(1) command on macOS Monterey

Screen Shot 2022 12 29 at 4 14 21 PM

Here it is on macOS Ventura

Screenshot 2022 12 29 at 4 22 45 PM

Ah, so it works!

Did Apple update something? I’m pretty sure it’s mentioned in the history section of the man page.

Here’s the man page of date(1) on macOS Monterey

Screen Shot 2022 12 29 at 4 25 18 PM

Wait, what?

What about the man page on macOS Ventura?

SCR 20221229 mr9

Well… Either someone forgot to update the man page on macOS Ventura, or someone forgot to merge the code properly on macOS Monterey

In either cases, I’m happy that Apple noticed the change and pulled the updated code from FreeBSD!

That’s all folks…

Reply via email.

Antranig Vartanian

December 22, 2022

Screenshot 2022 12 22 at 3 30 47 PM

Could this be a timezone math issue? No wait, I think it’s just bad written software issue!

Personally, I would prefer if it said “Currently doing XYZ” and ideally if it just printed the output of ^T (SIGINFO) somewhere in the window.

Reply via email.

Software Review: #MarsEdit version 5

I haven’t done anything like this before, so please, be gentle 🙂

I first heard of MarsEdit when I was browsing Gruber’s website and I saw it listed in his Essential Apps. At the time I was using Hugo as my “content manager” for my blog, so I moved on. Fast forward a year-or-two, I migrated to WordPress.

A week-or-so ago Gruber blogged about MarsEdit 5.0, so I decided to give it a go.

After 10 days of using it, here is my feedback.

First Impressions

I downloaded the app from Red Sweater Software’s website, at the time I didn’t know that it was also available on the App Store. A simple Zip file which contained the App, I moved it to the application folder and I started it.

Right from the start, it asks you two simple questions: Your blog’s name and the address.

I entered my Armenian blog’s name “Ազատութիւն Ամենեցուն” and address “անդրանիկ.հայ”. As you have noticed, it’s a unicode domain 🙂 This info will be important later.

MarsEdit automatically figured that I’m running WordPress and that it should use the WordPress API!

The interface is nice and intuitive. At first, you will see information about your blog, It’s made of two “parts”

SCR 20221219 kng

At the top is list of your posts and pages
At the bottom is a live preview of your selected page/post

The live preview doesn’t actually fetch things from your server, instead, you can have a template. Luckily, you can edit the preview settings and download your template. Unfortunately, there was (is?) a bug and MarsEdit was not able to download the template of my blog. First thing that came to my mind “I’m using a unicode domain, that might be the issue!” and turns out I was right. As soon as I added my English blog with its domain (the one that you’re reading right now!) the “Download Template…” button worked like a charm!

Screenshot 2022 12 19 at 3 09 40 PM

The Editor

This is, easily, the best editor I’ve seen for blogging.

SCR 20221219 lbx

You start with selecting your blog (1) and the post type (2), you can give your post a title (3), but turns out that’s not mandatory at all. As you start typing in the input box (4), you will notice the toolbar at the top (5), which has the basic formatting buttons such as Bold, Italic, Underline. There’s “adding a link” and paragraph formatting. For example —

This is a plain paragraph style

This is a quoted paragraph style

And this is a preformatted paragraph style

Depending on your theme, it will look different in preview/website and in the editor.

You can (and should!) also add tags (6), which MarsEdit will autocomplete while typing and select Categories (7). There is also the option to specify a “Featured Image”, I’ve never used this in MarsEdit nor in the WordPress editor, so no comments from me!

Finally, you can specify the server settings (9), such as the status of the post (Published, Draft, etc), Password protection, author (I actually DO run a multi-author blog!), comments and TraceBacks!

But the most impressive feature for me is the ability to save things locally, hence the Edited (10) at the title bar! I’m mostly on the move (well, not these day, it’s cold outside), while I don’t travel a lot, I do have daily work-things, such as going to a government office, a bank, a notary office, etc., which means I’m either commuting or waiting for my turn. While I have a mobile internet with me, we all know how old buildings are not built for the wireless era, so it amazes for me that I can just ⌘S and save my post locally to continue later.

All the local drafts are available in the… Local Drafts 😅

SCR 20221219 o9p

Amazing Niceties

The first nicety that I noticed was in the editor and it’s called “Typewriter Scrolling”. It does exactly what it says. The input box’s cursor will always be at the middle of the editor.

Screenshot 2022 12 19 at 5 33 31 PM

The second nicety is that everything is customizable, and I mean everything! For example, I blog a lot with coding samples, so I need a code tag. All I had to do was to go to Format → Customize… and I was able to create a new HTML tag for my code formatted text. Like this:
uname -a

And the final nicety that I noticed was the editor’s integration with TimeMachine-style restore points. I wish if every software had a feature like this!

Screenshot 2022 12 19 at 5 51 33 PM

Common (Personal?) Issues

I wasn’t planning on writing this review, at all, but since I wanted to try out MarsEdit before purchasing it, I wanted to use it intensively. In the last two weeks we had a Capture The Flag hacking competition and an Armenian InfoSec conference, so I blogged every details of these two events using MarsEdit. Actually, I was an organizer of the CTF competition, so I used MarsEdit to blog about everything from server installation, platform setup to “the food is here!” status updates 😄

That’s where I had my first issue! I set the Paragraph Style to Preformatted and I pasted some code, here’s how it looked like, if the code was multi-line;

Screenshot 2022 12 19 at 5 59 09 PM

It took me a while to realize, that I had to 1) set the Paragraph Style to Preformatted 2) Paste the code by doing Edit → Paste HTML Source. I’m not sure if this is an issue with my theme or not, but in case you get a similar issue, that’s how to solve it! Now, the code looks perfect 😇

Screenshot 2022 12 19 at 6 02 30 PM

The only other issue that I had was with the microposting feature, which is new in MarsEdit 5. It looks like a “status update” on Twitter or Mastodon.

Screenshot 2022 12 19 at 6 05 42 PM

When I first used this on MarsEdit 5, MarsEdit crashed. So finally, I’d like to talk about how

Daniel Jalkut is Amazing!

Like I said, I used MarsEdit 5 as soon as it came out, and the “New Micropost” feature crashed every time. Just 6 days after its initial release, Daniel released MarsEdit 5.0.1 which fixes the Micropost issue that I was having.

Finally, I send an email to Daniel saying

Greetings Daniel! how are you?

Looks like that MarsEdit is not crashing after upgrading to Version 5.0.1 (10611), however, a small question (feature request?):

In MarsEdit -> File -> New Post, I can set the Kind (Post Format) to Post, Aside, Status, etc.

I was wondering if there was a built-in way to make sure that my micro-posts are always set to Status? Microposts with no title look silly on WordPress, but in Status mode they look like a twitter/social-media status update!

I was wondering if I can implement that by using the Custom Fields tab in Blog Preferences.

Let me know!

Daniel replied to me just an hour later saying

Hi Antranig – this is a great idea and I’ll try to get it added as a preference ASAP. I’ll let you know when I have it in there!

Daniel

Conclusion

MarsEdit 5 is amazing. Currently it costs $59.95 for a Single User license and $89.95 for a Family Pack license (5 people in a private household), and let me tell you, it’s totally worth it!

MarsEdit 5 is my Christmas gift to myself.

If you are also a blogger who uses one of the platforms that MarsEdit supports (WordPress, Micro.blog, Tumblr, TypePad, Movable Type, and any blog that supports a standard MetaWeblog or AtomPub interface) and don’t want to open your browser every time an idea comes to your mind, then MarsEdit is for you.

P.S. WordPress’s Block Editor is also amazing. The WordPress team has done an amazing work with Gutenberg. And while I’ll be using MarsEdit for my personal blogs while writing from my Mac, Gutenberg has been amazing with my other WordPress blogs while writing from my FreeBSD laptop! Give that a try too! 😉

Reply via email.

FreeBSD arm64.aarch64 on QEMU/UTM with better (but not perfect) graphics

A week ago I posted about Running arm64.aarch64 FreeBSD on QEMU/UTM.app on Apple Silicon, and looks like

  1. Many people liked that post
  2. Everyone asked about running graphics (Xorg)

It took me a while but in the end it was, again, a simple change.

All you have to do is to add this single line to /boot/loader.conf

efi_max_resolution="1920x1080"

Now, QEMU’s display will not be 1080p, but it will be the following

VT(efifb): resolution 1024x768

Here are some screenshots

Here’s also Firefox doing an HTML5 test. As you can see, it passed the exam!

However, I’d like to get more resolution out of this. If you know how, please let me know.

That’s all folks…

Reply via email.

Running arm64.aarch64 FreeBSD on QEMU/UTM.app on Apple Silicon

Around a year ago I got an M1 MacBook Air for work. At this point, a lot of people that I know use these Apple Silicon machines.

While my personal machine is running FreeBSD, many times I’ve been in a situation where I need to run FreeBSD on my M1 MacBook Air, at least as a Virtual Machine.

For 9 months I’ve been running the AMD64 version of FreeBSD on QEMU/UTM.app using emulation. It gets the job done.

But whenever I want to do FreeBSD development, I need a fast machine. While M1 is pretty fast, VM emulation is still slow.

The problem is that whenever I booted the arm64.aarch64 FreeBSD on QEMU, it would use so much CPU on the host, that my battery would die in an hour or so.

After a lot of searching, I finally found this, this and this, which eventually got me to this page on the handbook

1. Set Boot Loader Variables
The most important step is to reduce the kern.hz tunable to reduce the CPU utilization of FreeBSD under the Parallels environment. This is accomplished by adding the following line to /boot/loader.conf:

kern.hz=100

Without this setting, an idle FreeBSD Parallels guest will use roughly 15% of the CPU of a single processor iMac®. After this change the usage will be closer to 5%.

Configuring FreeBSD on Parallels

So I tried that, and here you go!

Ahh, finally, I can do some work.

That’s all folks…

Reply via email.

Antranig Vartanian

September 23, 2022

I’m running two VMs on my M1 MacBook Air. An x86_64 FreeBSD and x86_64 LureOS (illuria‘s OS), both are emulated.

and yet, somehow, according to macOS, my browser is Using Significant Energy.

To be honest, I believe macOS, but the real question is, how did we get to a place where a piece of software is consuming more power than a complete Operating System?

Reply via email.

The command command

According to the 2018 edition of The Open Group Base Specifications (Issue 7), there’s a command named command which executes commands.

Wait, macOS is OpenGroup UNIX 03 certified, right?

command running uname -a

I tried tracing back the history, macOS is mostly based on FreeBSD, as we can see in their open-source code.

So I started tracing back the FreeBSD code, and I found the current one.

I found the oldest commit about command in FreeBSD’s source tree, but it said

Import the 4.4BSD-Lite2 /bin/sh sources

builtins.def

So I opened up the SVN tree of CSRG, and there I found this

date and time created 91/03/07 20:24:04 by bostic

builtins.def

However, if I knew how to use SVNWeb, I’m pretty sure I’d navigate around the /old/sh directory.

It’s funny, how this line
# NOTE: bltincmd must come first!
Is both in the macOS code AND the CSRG code from 30 years ago.

That’s all folks…

Reply via email.

Music.app is a good radio app

As I mention in my other post, macOS also has Music.app, which as I said I will to try it out as well.

Turns out it’s really good! I’ve been listening to DeepHouseRadio all day. When the connection drops while I go to the kitchen to make some coffee, it buffers it properly. Although once it skipped and started playing the “next song” which was some media file.

While doing my testing, I realized that the Music.app has Radio included in it! It fetches the list of radio stations from TuneIn, which I loved using their app on my BlackBerry 9780 back in the day.

Good job Apple, not updating your QuickTime Player, but at least making sure that one of your out-of-the-box apps handles a thing properly.

That’s all folks…

Reply via email.

The OS App vs The Browser OS

I like listening to online radios like anonradio and DeepHouseRadio, instead of me trying to organize my local library or listening the same music over and over again on Deezer, I get lazy and just use their HTTP link.

Like a sane person, I would use a media player to “open” these HTTP radio links. On my FreeBSD machine, all I need to do is mplayer http://the.domain/path/to/content, but on macOS it would not be that simple.

The default media player on macOS is QuickTime. Here is where my problems start. I open QuickTime Player, I set the location to the HTTP link and it all works fine. Until it doesn’t. A small network lag and it stops playing completely.

I am usually connected to the internet via a cable in my office or the house, but when I go wireless, there’s a blind spot in one of the rooms. My FreeBSD laptop with mplayer handles it all fine, but QuickTime? Not so much.

So I decided to use the “other” “Operating System” in macOS, also known as a browser, in this case Firefox. I open the link and it all works fine. Even if there’s a network lag, Firefox would handle it fine.

It’s sad funny how browsers are handling things better than native desktop programs these days.

While writing this blog-post I realized that macOS has another media player known as Music.app, so will try with that as well, let’s see how it will handle it.

That’s all folks.

Reply via email.