John Bokma wrote:
Soon SSD is luxury ;-).
I _just_ missed the ridiculous price increases when I bought my 2 TB
Samsung 990 EVO for $175 CAD last year. The price has doubled since. The
way things are going, I will probably just wait for my laptop to
completely die before I replace it.
One thing I like about macOS is the level of choice. A UNIX CLI with
a world class GUI.
On 05/05/2026 02:54, Lawrence D’Oliveiro wrote:
Are Mac users really brave enough to try command-line tools?
Of course. Projects like homebrew and Mac Ports show that there is a
serious interest in cli tools for macOS. Also Nix provides a huge
number of packages for macOS.
some thing wrote:
One thing I like about macOS is the level of choice. A UNIX CLI with
a world class GUI.
Only one?
On May 5, 2026 at 10:32:05 AM MST, "John Bokma" wrote <10td9im$jmc1$1@dont-email.me>:
One can (almost) always install the same command on macOS.
True... but Linux comes with more. There are also different flags
and it is usually easier to find Linux info.
If you install GNU commands you have to prefix them with g, e.g.
gfind, gls, ggrep.
CrudeSausage wrote:
John Bokma wrote:
Soon SSD is luxury ;-).
Let's hope not.
I _just_ missed the ridiculous price increases when I bought my 2 TB
Samsung 990 EVO for $175 CAD last year. The price has doubled since. The
way things are going, I will probably just wait for my laptop to
completely die before I replace it.
With the Alder Lake and Raptor Lake PC's that I built in the last few
years, I'm good for another five years or more.
Video card prices are actually still OK. I suppose because fewer new
gaming PC's are being built.
On 05 May 2026 17:50:08 GMT, Brock McNuggets wrote:
On May 5, 2026 at 10:32:05 AM MST, "John Bokma" wrote
<10td9im$jmc1$1@dont-email.me>:
One can (almost) always install the same command on macOS.
True... but Linux comes with more. There are also different flags
and it is usually easier to find Linux info.
Most Linux systems use the GNU tools, as Richard Stallman never tires
of reminding us ;).
Back in the days when “Unix” meant something, it was quite common for sysadmins, when setting up a Unix workstation or server for the first
time, to immediately install a bunch of the GNU tools, and use them in preference to the vendor-provided equivalents. The GNU versions were
usually less buggy, more featureful, and also often more
standards-compliant.
So you could say that Apple’s “Unix” continues this tradition ...
On 05 May 2026 13:54:10 GMT, Brock McNuggets wrote:
One thing I like about macOS is the level of choice. A UNIX CLI with
a world class GUI.
Only one?
On Tue, 5 May 2026 17:37:37 +0200, John Bokma wrote:
On 05/05/2026 02:54, Lawrence D’Oliveiro wrote:
Are Mac users really brave enough to try command-line tools?
Of course. Projects like homebrew and Mac Ports show that there is a
serious interest in cli tools for macOS. Also Nix provides a huge
number of packages for macOS.
Do they all offer the same packages? Or do you need to install more
than one to get the full range?
On Tue, 5 May 2026 20:04:19 +0200, John Bokma wrote:
If you install GNU commands you have to prefix them with g, e.g.
gfind, gls, ggrep.
If you do that, is there a chance you could cause conflicts with
scripts that rely on the Apple-provided utilities by that name?
If you don’t do that, how do you exchange compatible scripts with
Linux systems, or even BSD ones?
On 05/05/2026 23:46, Lawrence D’Oliveiro wrote:
On Tue, 5 May 2026 17:37:37 +0200, John Bokma wrote:
On 05/05/2026 02:54, Lawrence D’Oliveiro wrote:
Are Mac users really brave enough to try command-line tools?
Of course. Projects like homebrew and Mac Ports show that there is a
serious interest in cli tools for macOS. Also Nix provides a huge
number of packages for macOS.
Do they all offer the same packages? Or do you need to install more
than one to get the full range?
I have no idea. Based on my experience homebrew is a safe bet: most open source I have seen has instructions on how to install via homebrew.
In the near future I want to check out nix.
On 2026-05-06 10:41 a.m., John Bokma wrote:
In the near future I want to check out nix.
Prepare to be disappointed.
On 06/05/2026 18:24, CrudeSausage wrote:
On 2026-05-06 10:41 a.m., John Bokma wrote:
[..]
In the near future I want to check out nix.
Prepare to be disappointed.
Why?[1]
[1] I mean the package manager ;-)
On 2026-05-06 12:27 p.m., John Bokma wrote:
On 06/05/2026 18:24, CrudeSausage wrote:
On 2026-05-06 10:41 a.m., John Bokma wrote:
[..]
In the near future I want to check out nix.
Prepare to be disappointed.
Why?[1]
[1] I mean the package manager ;-)
Linux is filled with excellent ideas that simply aren't executed
properly.
On 06/05/2026 18:31, CrudeSausage wrote:
On 2026-05-06 12:27 p.m., John Bokma wrote:
On 06/05/2026 18:24, CrudeSausage wrote:
On 2026-05-06 10:41 a.m., John Bokma wrote:
[..]
In the near future I want to check out nix.
Prepare to be disappointed.
Why?[1]
[1] I mean the package manager ;-)
Linux is filled with excellent ideas that simply aren't executed
properly.
It's a package manager. Not Linux.
The actual package manager is called nix?
Are Mac users really brave enough to try command-line tools?
<https://www.zdnet.com/article/macos-command-line-utilities-that-are-far-more-useful-than-you-think/>
All of them are available for Linux, and are probably easier to
install and use there than on a Mac.
Guess where the “real Unix” is to be found ...
Well...I DO have it. And actually, it's much better than ag.
It's called "mdfind".
On 06/05/2026 18:56, CrudeSausage wrote:
The actual package manager is called nix?
Yes. And the OS is called NixOS: <https://nixos.org/>
On 06/05/2026 18:56, CrudeSausage wrote:
The actual package manager is called nix?
Yes. And the OS is called NixOS: <https://nixos.org/>
On 06/05/2026 19:37, Alan wrote:
[..]
Well...I DO have it. And actually, it's much better than ag.
It's called "mdfind".
While there is some overlap, they are very different tools.
On 2026-05-06 10:52, John Bokma wrote:
On 06/05/2026 19:37, Alan wrote:
[..]
Well...I DO have it. And actually, it's much better than ag.
It's called "mdfind".
While there is some overlap, they are very different tools.
They ARE different tools!
But the one thing the article specifically highlights...
...is already done far, FAR better by mdfind.
That's just a fact.
On 2026-05-06 1:09 p.m., John Bokma wrote:
On 06/05/2026 18:56, CrudeSausage wrote:
The actual package manager is called nix?
Yes. And the OS is called NixOS: <https://nixos.org/>
And NixOS is not Linux?
On 2026-05-06 1:09 p.m., John Bokma wrote:
On 06/05/2026 18:56, CrudeSausage wrote:
The actual package manager is called nix?
Yes. And the OS is called NixOS: <https://nixos.org/>
Literally from the NixOS.org page:
"NixOS is a Linux distribution built around the Nix package manager."
On 06/05/2026 20:58, Alan wrote:
On 2026-05-06 10:52, John Bokma wrote:
On 06/05/2026 19:37, Alan wrote:
[..]
Well...I DO have it. And actually, it's much better than ag.
It's called "mdfind".
While there is some overlap, they are very different tools.
They ARE different tools!
But the one thing the article specifically highlights...
...is already done far, FAR better by mdfind.
That's just a fact.
Can you show me how to use mdfind to:
search in all python only files for the word 'cat' showing the line the
word 'cat' is found on and the 3 lines before this line and 2 after?
On 06/05/2026 20:04, CrudeSausage wrote:
On 2026-05-06 1:09 p.m., John Bokma wrote:
On 06/05/2026 18:56, CrudeSausage wrote:
The actual package manager is called nix?
Yes. And the OS is called NixOS: <https://nixos.org/>
And NixOS is not Linux?
Yes, it's Linux. However, Nix (the package manager) can be used without Linux.
Sure!
mdfind "kMDItemFSName == '*.py' && kMDItemTextContent == 'cat'" -0 |
xargs -0 grep -i -B 3 -A 2 "cat"
Didn't need to install an additional piece of software at all!
On Wed, 6 May 2026 13:34:55 -0700, Alan wrote:
Sure!
mdfind "kMDItemFSName == '*.py' && kMDItemTextContent == 'cat'" -0 |
xargs -0 grep -i -B 3 -A 2 "cat"
Didn't need to install an additional piece of software at all!
And this is easier than 'find . -name "*.py" | .....
On 2026-05-06 12:57, John Bokma wrote:
Can you show me how to use mdfind to:
search in all python only files for the word 'cat' showing the line
the word 'cat' is found on and the 3 lines before this line and 2 after?
Sure!
mdfind "kMDItemFSName == '*.py' && kMDItemTextContent == 'cat'" -0 |
xargs -0 grep -i -B 3 -A 2 "cat"
Didn't need to install an additional piece of software at all!
On 06/05/2026 22:34, Alan wrote:
On 2026-05-06 12:57, John Bokma wrote:
[..]
Can you show me how to use mdfind to:
search in all python only files for the word 'cat' showing the line
the word 'cat' is found on and the 3 lines before this line and 2 after? >>>
Sure!
mdfind "kMDItemFSName == '*.py' && kMDItemTextContent == 'cat'" -0 |
xargs -0 grep -i -B 3 -A 2 "cat"
Didn't need to install an additional piece of software at all!
Ok, fair enough, although you need extra commands.
ag --python -B3 -A2 '\bcat\b'
Easier to remember.
On 2026-05-06 18:34, rbowman wrote:
On Wed, 6 May 2026 13:34:55 -0700, Alan wrote:
Sure!
mdfind "kMDItemFSName == '*.py' && kMDItemTextContent == 'cat'" -0 |
xargs -0 grep -i -B 3 -A 2 "cat"
Didn't need to install an additional piece of software at all!
And this is easier than 'find . -name "*.py" | .....
Faster... ...like a LOT faster; impossibly faster.
On my drive with 2,711,067 files, running my command takes...
(Running it again now)
...1 second.
On 2026-05-07 03:08, John Bokma wrote:
On 06/05/2026 22:34, Alan wrote:
On 2026-05-06 12:57, John Bokma wrote:
[..]
Can you show me how to use mdfind to:Sure!
search in all python only files for the word 'cat' showing the line
the word 'cat' is found on and the 3 lines before this line and 2 after? >>>
mdfind "kMDItemFSName == '*.py' && kMDItemTextContent == 'cat'" -0 |
xargs -0 grep -i -B 3 -A 2 "cat"
Didn't need to install an additional piece of software at all!
Ok, fair enough, although you need extra commands.
ag --python -B3 -A2 '\bcat\b'
Easier to remember.
Given that the tools exist to "remember" for you, that hardly matters,
and I guarantee you that mdfind is orders of magnitude faster.
Alan wrote this screed in ALL-CAPS:Nope.
On 2026-05-06 18:34, rbowman wrote:
On Wed, 6 May 2026 13:34:55 -0700, Alan wrote:
Sure!
mdfind "kMDItemFSName == '*.py' && kMDItemTextContent == 'cat'" -0 |
xargs -0 grep -i -B 3 -A 2 "cat"
Didn't need to install an additional piece of software at all!
And this is easier than 'find . -name "*.py" | .....
Faster... ...like a LOT faster; impossibly faster.
On my drive with 2,711,067 files, running my command takes...
(Running it again now)
...1 second.
Cached, obviously :-D
Alan wrote this screed in ALL-CAPS:You need to learn a little more about how Apple implemented what in the
On 2026-05-07 03:08, John Bokma wrote:
On 06/05/2026 22:34, Alan wrote:
On 2026-05-06 12:57, John Bokma wrote:
[..]
Can you show me how to use mdfind to:Sure!
search in all python only files for the word 'cat' showing the line
the word 'cat' is found on and the 3 lines before this line and 2 after? >>>>
mdfind "kMDItemFSName == '*.py' && kMDItemTextContent == 'cat'" -0 |
xargs -0 grep -i -B 3 -A 2 "cat"
Didn't need to install an additional piece of software at all!
Ok, fair enough, although you need extra commands.
ag --python -B3 -A2 '\bcat\b'
Easier to remember.
Given that the tools exist to "remember" for you, that hardly matters,
and I guarantee you that mdfind is orders of magnitude faster.
Sounds a bit like UNIX locate/plocate.
On 2026-05-08 10:44, Chris Ahlstrom wrote:
Alan wrote this screed in ALL-CAPS:Nope.
On 2026-05-06 18:34, rbowman wrote:
On Wed, 6 May 2026 13:34:55 -0700, Alan wrote:
Sure!
mdfind "kMDItemFSName == '*.py' && kMDItemTextContent == 'cat'" -0 | >>>>> xargs -0 grep -i -B 3 -A 2 "cat"
Didn't need to install an additional piece of software at all!
And this is easier than 'find . -name "*.py" | .....
Faster... ...like a LOT faster; impossibly faster.
On my drive with 2,711,067 files, running my command takes...
(Running it again now)
...1 second.
Cached, obviously :-D
Indexed.
On 2026-05-08 10:52, Chris Ahlstrom wrote:
Alan wrote this screed in ALL-CAPS:You need to learn a little more about how Apple implemented what in the
On 2026-05-07 03:08, John Bokma wrote:
On 06/05/2026 22:34, Alan wrote:
On 2026-05-06 12:57, John Bokma wrote:
[..]
Can you show me how to use mdfind to:Sure!
search in all python only files for the word 'cat' showing the line >>>>>> the word 'cat' is found on and the 3 lines before this line and 2 after? >>>>>
mdfind "kMDItemFSName == '*.py' && kMDItemTextContent == 'cat'" -0 | >>>>> xargs -0 grep -i -B 3 -A 2 "cat"
Didn't need to install an additional piece of software at all!
Ok, fair enough, although you need extra commands.
ag --python -B3 -A2 '\bcat\b'
Easier to remember.
Given that the tools exist to "remember" for you, that hardly matters,
and I guarantee you that mdfind is orders of magnitude faster.
Sounds a bit like UNIX locate/plocate.
GUI part of the OS is called "Spotlight".
"mdfind" is just a command line tool that leverages the same index that
is created for Spotlight.
I just ran this:
agbaker@Alans-M3 / % time mdfind ahlstrom
The result:
2026-05-08 11:37:24.286 mdfind[57515:2714553] [UserQueryParser] Loading keywords and predicates for locale "en_CA"
2026-05-08 11:37:24.286 mdfind[57515:2714553] [UserQueryParser] Loading keywords and predicates for locale "en"
/Users/agbaker/Library/Group
Containers/UBF8T346G9.Office/Outlook/Outlook 15 Profiles/Main Profile/Data/Messages/109/6DCA995E-E984-4A01-8FEA-ECF490248F0B.olk15Message
mdfind ahlstrom 0.04s user 0.06s system 38% cpu 0.259 total
Alan wrote this screed in ALL-CAPS:
On 2026-05-08 10:44, Chris Ahlstrom wrote:
Alan wrote this screed in ALL-CAPS:Nope.
On 2026-05-06 18:34, rbowman wrote:
On Wed, 6 May 2026 13:34:55 -0700, Alan wrote:
Sure!
mdfind "kMDItemFSName == '*.py' && kMDItemTextContent == 'cat'" -0 | >>>>>> xargs -0 grep -i -B 3 -A 2 "cat"
Didn't need to install an additional piece of software at all!
And this is easier than 'find . -name "*.py" | .....
Faster... ...like a LOT faster; impossibly faster.
On my drive with 2,711,067 files, running my command takes...
(Running it again now)
...1 second.
Cached, obviously :-D
Indexed.
And cached.
Alan wrote this screed in ALL-CAPS:
On 2026-05-08 10:52, Chris Ahlstrom wrote:
Alan wrote this screed in ALL-CAPS:You need to learn a little more about how Apple implemented what in the
On 2026-05-07 03:08, John Bokma wrote:
On 06/05/2026 22:34, Alan wrote:
On 2026-05-06 12:57, John Bokma wrote:
[..]
Can you show me how to use mdfind to:
search in all python only files for the word 'cat' showing the line >>>>>>> the word 'cat' is found on and the 3 lines before this line and 2 after?
Sure!
mdfind "kMDItemFSName == '*.py' && kMDItemTextContent == 'cat'" -0 | >>>>>> xargs -0 grep -i -B 3 -A 2 "cat"
Didn't need to install an additional piece of software at all!
Ok, fair enough, although you need extra commands.
ag --python -B3 -A2 '\bcat\b'
Easier to remember.
Given that the tools exist to "remember" for you, that hardly matters, >>>> and I guarantee you that mdfind is orders of magnitude faster.
Sounds a bit like UNIX locate/plocate.
GUI part of the OS is called "Spotlight".
"mdfind" is just a command line tool that leverages the same index that
is created for Spotlight.
Duh-uh. I found that out on my own.
I just ran this:
agbaker@Alans-M3 / % time mdfind ahlstrom
The result:
2026-05-08 11:37:24.286 mdfind[57515:2714553] [UserQueryParser] Loading
keywords and predicates for locale "en_CA"
2026-05-08 11:37:24.286 mdfind[57515:2714553] [UserQueryParser] Loading
keywords and predicates for locale "en"
/Users/agbaker/Library/Group
Containers/UBF8T346G9.Office/Outlook/Outlook 15 Profiles/Main
Profile/Data/Messages/109/6DCA995E-E984-4A01-8FEA-ECF490248F0B.olk15Message >>
mdfind ahlstrom 0.04s user 0.06s system 38% cpu 0.259 total
Whoop de do.
$ time locate ahlstrom &> /dev/null
real 0m1.027s
user 0m0.927s
sys 0m0.141s
This is on my computer, and emits 442650 hits (as counted by
piping the command to wc -l.)
Another example, a more realistic use of locate:
$ time locate vim
real 0m0.043s
user 0m0.015s
sys 0m0.023s
On 2026-05-09 05:59, Chris Ahlstrom wrote:
Alan wrote this screed in ALL-CAPS:
On 2026-05-08 10:44, Chris Ahlstrom wrote:
Alan wrote this screed in ALL-CAPS:Nope.
On 2026-05-06 18:34, rbowman wrote:
On Wed, 6 May 2026 13:34:55 -0700, Alan wrote:
Sure!
mdfind "kMDItemFSName == '*.py' && kMDItemTextContent == 'cat'" -0 | >>>>>>> xargs -0 grep -i -B 3 -A 2 "cat"
Didn't need to install an additional piece of software at all!
And this is easier than 'find . -name "*.py" | .....
Faster... ...like a LOT faster; impossibly faster.
On my drive with 2,711,067 files, running my command takes...
(Running it again now)
...1 second.
Cached, obviously :-D
Indexed.
And cached.
Nope.
Yes, there is an index.
No, nothing was cached.
On 2026-05-09 06:06, Chris Ahlstrom wrote:
Alan wrote this screed in ALL-CAPS:
On 2026-05-08 10:52, Chris Ahlstrom wrote:
Alan wrote this screed in ALL-CAPS:You need to learn a little more about how Apple implemented what in the
On 2026-05-07 03:08, John Bokma wrote:
On 06/05/2026 22:34, Alan wrote:
On 2026-05-06 12:57, John Bokma wrote:
[..]
Can you show me how to use mdfind to:
search in all python only files for the word 'cat' showing the line >>>>>>>> the word 'cat' is found on and the 3 lines before this line and 2 after?
Sure!
mdfind "kMDItemFSName == '*.py' && kMDItemTextContent == 'cat'" -0 | >>>>>>> xargs -0 grep -i -B 3 -A 2 "cat"
Didn't need to install an additional piece of software at all!
Ok, fair enough, although you need extra commands.
ag --python -B3 -A2 '\bcat\b'
Easier to remember.
Given that the tools exist to "remember" for you, that hardly matters, >>>>> and I guarantee you that mdfind is orders of magnitude faster.
Sounds a bit like UNIX locate/plocate.
GUI part of the OS is called "Spotlight".
"mdfind" is just a command line tool that leverages the same index that
is created for Spotlight.
Duh-uh. I found that out on my own.
I just ran this:
agbaker@Alans-M3 / % time mdfind ahlstrom
The result:
2026-05-08 11:37:24.286 mdfind[57515:2714553] [UserQueryParser] Loading
keywords and predicates for locale "en_CA"
2026-05-08 11:37:24.286 mdfind[57515:2714553] [UserQueryParser] Loading
keywords and predicates for locale "en"
/Users/agbaker/Library/Group
Containers/UBF8T346G9.Office/Outlook/Outlook 15 Profiles/Main
Profile/Data/Messages/109/6DCA995E-E984-4A01-8FEA-ECF490248F0B.olk15Message >>>
mdfind ahlstrom 0.04s user 0.06s system 38% cpu 0.259 total
Whoop de do.
$ time locate ahlstrom &> /dev/null
real 0m1.027s
user 0m0.927s
sys 0m0.141s
This is on my computer, and emits 442650 hits (as counted by
piping the command to wc -l.)
Another example, a more realistic use of locate:
$ time locate vim
real 0m0.043s
user 0m0.015s
sys 0m0.023s
"locate" doesn't locate everything.
"mdfind" and the system it uses indexing everything.
Alan wrote this screed in ALL-CAPS:
On 2026-05-09 06:06, Chris Ahlstrom wrote:
Alan wrote this screed in ALL-CAPS:
On 2026-05-08 10:52, Chris Ahlstrom wrote:
Alan wrote this screed in ALL-CAPS:You need to learn a little more about how Apple implemented what in the >>>> GUI part of the OS is called "Spotlight".
On 2026-05-07 03:08, John Bokma wrote:
On 06/05/2026 22:34, Alan wrote:
On 2026-05-06 12:57, John Bokma wrote:
[..]
Can you show me how to use mdfind to:
search in all python only files for the word 'cat' showing the line >>>>>>>>> the word 'cat' is found on and the 3 lines before this line and 2 after?
Sure!
mdfind "kMDItemFSName == '*.py' && kMDItemTextContent == 'cat'" -0 | >>>>>>>> xargs -0 grep -i -B 3 -A 2 "cat"
Didn't need to install an additional piece of software at all!
Ok, fair enough, although you need extra commands.
ag --python -B3 -A2 '\bcat\b'
Easier to remember.
Given that the tools exist to "remember" for you, that hardly matters, >>>>>> and I guarantee you that mdfind is orders of magnitude faster.
Sounds a bit like UNIX locate/plocate.
"mdfind" is just a command line tool that leverages the same index that >>>> is created for Spotlight.
Duh-uh. I found that out on my own.
I just ran this:
agbaker@Alans-M3 / % time mdfind ahlstrom
The result:
2026-05-08 11:37:24.286 mdfind[57515:2714553] [UserQueryParser] Loading >>>> keywords and predicates for locale "en_CA"
2026-05-08 11:37:24.286 mdfind[57515:2714553] [UserQueryParser] Loading >>>> keywords and predicates for locale "en"
/Users/agbaker/Library/Group
Containers/UBF8T346G9.Office/Outlook/Outlook 15 Profiles/Main
Profile/Data/Messages/109/6DCA995E-E984-4A01-8FEA-ECF490248F0B.olk15Message
mdfind ahlstrom 0.04s user 0.06s system 38% cpu 0.259 total
Whoop de do.
$ time locate ahlstrom &> /dev/null
real 0m1.027s
user 0m0.927s
sys 0m0.141s
This is on my computer, and emits 442650 hits (as counted by
piping the command to wc -l.)
Another example, a more realistic use of locate:
$ time locate vim
real 0m0.043s
user 0m0.015s
sys 0m0.023s
"locate" doesn't locate everything.
Define "everything".
"mdfind" and the system it uses indexing everything.
You really need to be precise, because index all information on
a disk would be huge.
$ locate xyz
This finds about 20 files on this system.
Fwiw, /var/lib/plocate/plocate.db is about 22 Mb on this system.
Alan wrote this screed in ALL-CAPS:
On 2026-05-09 05:59, Chris Ahlstrom wrote:
Alan wrote this screed in ALL-CAPS:
On 2026-05-08 10:44, Chris Ahlstrom wrote:
Alan wrote this screed in ALL-CAPS:Nope.
On 2026-05-06 18:34, rbowman wrote:
On Wed, 6 May 2026 13:34:55 -0700, Alan wrote:
Sure!
mdfind "kMDItemFSName == '*.py' && kMDItemTextContent == 'cat'" -0 | >>>>>>>> xargs -0 grep -i -B 3 -A 2 "cat"
Didn't need to install an additional piece of software at all!
And this is easier than 'find . -name "*.py" | .....
Faster... ...like a LOT faster; impossibly faster.
On my drive with 2,711,067 files, running my command takes...
(Running it again now)
...1 second.
Cached, obviously :-D
Indexed.
And cached.
Nope.
Yes, there is an index.
No, nothing was cached.
Are you saying that MacOS does not cache data? Data such as... an
index?
Surely you're joking, Mr. Fine Man!
Alan wrote this screed in ALL-CAPS:
On 2026-05-09 06:06, Chris Ahlstrom wrote:
Alan wrote this screed in ALL-CAPS:
On 2026-05-08 10:52, Chris Ahlstrom wrote:
Alan wrote this screed in ALL-CAPS:You need to learn a little more about how Apple implemented what in the >>>> GUI part of the OS is called "Spotlight".
On 2026-05-07 03:08, John Bokma wrote:
On 06/05/2026 22:34, Alan wrote:
On 2026-05-06 12:57, John Bokma wrote:
[..]
Can you show me how to use mdfind to:
search in all python only files for the word 'cat' showing the line >>>>>>>>> the word 'cat' is found on and the 3 lines before this line and 2 after?
Sure!
mdfind "kMDItemFSName == '*.py' && kMDItemTextContent == 'cat'" -0 | >>>>>>>> xargs -0 grep -i -B 3 -A 2 "cat"
Didn't need to install an additional piece of software at all!
Ok, fair enough, although you need extra commands.
ag --python -B3 -A2 '\bcat\b'
Easier to remember.
Given that the tools exist to "remember" for you, that hardly matters, >>>>>> and I guarantee you that mdfind is orders of magnitude faster.
Sounds a bit like UNIX locate/plocate.
"mdfind" is just a command line tool that leverages the same index that >>>> is created for Spotlight.
Duh-uh. I found that out on my own.
I just ran this:
agbaker@Alans-M3 / % time mdfind ahlstrom
The result:
2026-05-08 11:37:24.286 mdfind[57515:2714553] [UserQueryParser] Loading >>>> keywords and predicates for locale "en_CA"
2026-05-08 11:37:24.286 mdfind[57515:2714553] [UserQueryParser] Loading >>>> keywords and predicates for locale "en"
/Users/agbaker/Library/Group
Containers/UBF8T346G9.Office/Outlook/Outlook 15 Profiles/Main
Profile/Data/Messages/109/6DCA995E-E984-4A01-8FEA-ECF490248F0B.olk15Message
mdfind ahlstrom 0.04s user 0.06s system 38% cpu 0.259 total
Whoop de do.
$ time locate ahlstrom &> /dev/null
real 0m1.027s
user 0m0.927s
sys 0m0.141s
This is on my computer, and emits 442650 hits (as counted by
piping the command to wc -l.)
Another example, a more realistic use of locate:
$ time locate vim
real 0m0.043s
user 0m0.015s
sys 0m0.023s
"locate" doesn't locate everything.
Define "everything".
"mdfind" and the system it uses indexing everything.
You really need to be precise, because index all information on
a disk would be huge.
$ locate xyz
This finds about 20 files on this system.
Fwiw, /var/lib/plocate/plocate.db is about 22 Mb on this system.
On 2026-05-10 05:06, Chris Ahlstrom wrote:
Alan wrote this screed in ALL-CAPS:
On 2026-05-09 05:59, Chris Ahlstrom wrote:
Alan wrote this screed in ALL-CAPS:
On 2026-05-08 10:44, Chris Ahlstrom wrote:
Alan wrote this screed in ALL-CAPS:Nope.
On 2026-05-06 18:34, rbowman wrote:
On Wed, 6 May 2026 13:34:55 -0700, Alan wrote:
Sure!And this is easier than 'find . -name "*.py" | .....
mdfind "kMDItemFSName == '*.py' && kMDItemTextContent == 'cat'" -0 | >>>>>>>>> xargs -0 grep -i -B 3 -A 2 "cat"
Didn't need to install an additional piece of software at all! >>>>>>>>
Faster... ...like a LOT faster; impossibly faster.
On my drive with 2,711,067 files, running my command takes...
(Running it again now)
...1 second.
Cached, obviously :-D
Indexed.
And cached.
Nope.
Yes, there is an index.
No, nothing was cached.
Are you saying that MacOS does not cache data? Data such as... an
index?
Surely you're joking, Mr. Fine Man!
An index is not a cache.
You were trying to imply that it ran fast because it had run immediately before.
Alan wrote this screed in ALL-CAPS:
On 2026-05-10 05:06, Chris Ahlstrom wrote:
Alan wrote this screed in ALL-CAPS:
On 2026-05-09 05:59, Chris Ahlstrom wrote:
Alan wrote this screed in ALL-CAPS:
On 2026-05-08 10:44, Chris Ahlstrom wrote:
Alan wrote this screed in ALL-CAPS:Nope.
On 2026-05-06 18:34, rbowman wrote:
On Wed, 6 May 2026 13:34:55 -0700, Alan wrote:
Sure!And this is easier than 'find . -name "*.py" | .....
mdfind "kMDItemFSName == '*.py' && kMDItemTextContent == 'cat'" -0 | >>>>>>>>>> xargs -0 grep -i -B 3 -A 2 "cat"
Didn't need to install an additional piece of software at all! >>>>>>>>>
Faster... ...like a LOT faster; impossibly faster.
On my drive with 2,711,067 files, running my command takes...
(Running it again now)
...1 second.
Cached, obviously :-D
Indexed.
And cached.
Nope.
Yes, there is an index.
No, nothing was cached.
Are you saying that MacOS does not cache data? Data such as... an
index?
Surely you're joking, Mr. Fine Man!
An index is not a cache.
Duh!
You were trying to imply that it ran fast because it had run immediately
before.
I'm done with you, so obtuse, on this topic.
On Sun, 10 May 2026 08:16:39 -0400, Chris Ahlstrom wrote:
$ locate xyz
This finds about 20 files on this system.
It finds 134 on mine :) That's what happens when you mess around with GIS stuff. There are a lot of Python and Node library files to handle tile requests. The plocate database is 40 MB.
rbowman wrote this screed in ALL-CAPS:
On Sun, 10 May 2026 08:16:39 -0400, Chris Ahlstrom wrote:
$ locate xyz
This finds about 20 files on this system.
It finds 134 on mine :) That's what happens when you mess around with GIS >> stuff. There are a lot of Python and Node library files to handle tile
requests. The plocate database is 40 MB.
Arguing with an Apple fanboi is like mud wrestling a pig.
Seems so. I explicitly noted that an index can be cached.
On 2026-05-11 04:33, Chris Ahlstrom wrote:
rbowman wrote this screed in ALL-CAPS:
On Sun, 10 May 2026 08:16:39 -0400, Chris Ahlstrom wrote:
$ locate xyz
This finds about 20 files on this system.
It finds 134 on mine :) That's what happens when you mess around
with GIS stuff. There are a lot of Python and Node library files to
handle tile requests. The plocate database is 40 MB.
Arguing with an Apple fanboi is like mud wrestling a pig.
Seems so. I explicitly noted that an index can be cached.
No. You made no such explicit claim...
...but good job running away to the safety of COLA.
:-)
Alan <nuh-uh@nope.com> wrote in news:10tt3h2$19gng$2@dont-email.me:
On 2026-05-11 04:33, Chris Ahlstrom wrote:
rbowman wrote this screed in ALL-CAPS:
On Sun, 10 May 2026 08:16:39 -0400, Chris Ahlstrom wrote:
$ locate xyz
This finds about 20 files on this system.
It finds 134 on mine :) That's what happens when you mess around
with GIS stuff. There are a lot of Python and Node library files to
handle tile requests. The plocate database is 40 MB.
Arguing with an Apple fanboi is like mud wrestling a pig.
Seems so. I explicitly noted that an index can be cached.
No. You made no such explicit claim...
...but good job running away to the safety of COLA.
:-)
How much is Apple paying you Alan to be an extreme fanboy?
Whatever it is, they are wasting their money because you are considered a joke. Nobody trusts your post. Most people ignore them.
So how much you making to spew this garbage?
Alan <nuh-uh@nope.com> wrote in news:10tt3h2$19gng$2@dont-email.me:
On 2026-05-11 04:33, Chris Ahlstrom wrote:
rbowman wrote this screed in ALL-CAPS:
On Sun, 10 May 2026 08:16:39 -0400, Chris Ahlstrom wrote:
$ locate xyz
This finds about 20 files on this system.
It finds 134 on mine :) That's what happens when you mess around
with GIS stuff. There are a lot of Python and Node library files to
handle tile requests. The plocate database is 40 MB.
Arguing with an Apple fanboi is like mud wrestling a pig.
Seems so. I explicitly noted that an index can be cached.
No. You made no such explicit claim...
...but good job running away to the safety of COLA.
:-)
How much is Apple paying you Alan to be an extreme fanboy?
Whatever it is, they are wasting their money because you are considered a joke. Nobody trusts your post. Most people ignore them.
So how much you making to spew this garbage?
| Sysop: | DaiTengu |
|---|---|
| Location: | Appleton, WI |
| Users: | 1,116 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 86:54:10 |
| Calls: | 14,305 |
| Files: | 186,338 |
| D/L today: |
1,016 files (320M bytes) |
| Messages: | 2,525,511 |