Revelando archivos en el Finder desde el Terminal utilizando AppleScript

Una de las mejores y más únicas características de macOS (nacido como Mac OS X, y transitoriamente como OS X) es su capacidad de combinar el interfaz clásico para navegación de archivos del Mac, el Finder, con el Terminal, y el soporte para ese lenguaje de pegamento y automatización que es AppleScript.

A veces uno realiza una búsqueda en terminal con comandos como find, grep, locate, o mdfind (el interfaz de terminal al motor de búsqueda Spotlight), pero quiere poder ver esos archivos en el Finder. Un podría usar la opción -R en el comando open, pero eso sirve sólo para un único archivo/carpeta (aunque la documentación dice que sirve para múltiples archivos). ¿Cómo hacerlo para múltiples archivos?

La clave está en AppleScript: el diccionario de comandos del Finder contiene un comando reveal_files al que se le puede pasar una lista de archivos. Como los archivos en terminal van separados por barras inclinadas (/), es necesario agregar as POSIX file al final de cada uno.

Con esa precaución, he creado una función reveal_files que lee sobre toda la lista de argumentos ($@), y para cada archivo ($file) genera la lista de AppleScript para después, con ella, llamar al comando osascript con el comando tell application "Finder" to reveal files {/path/file1 as POSIX file, /path/file2 as POSIX file, /path/file3 as POSIX file…}, que instruye al Finder a que muestre tantas carpetas como sea necesario, con los archivos que pertenezcan a cada una seleccionados.

El código completo del script podéis verlo a continuación (o en este link al Gist reveal_files.sh). ¡Espero que os sea útil!

https://gist.github.com/juandesant/8c288d7ac7d8578b53799fadfe34dfa8

Actualización 2025-12-18: El script no sirve si no le pasas archivos que estén con toda la ruta completa. Por ejemplo, reveal_files MiArchivo1.pdf MiArchivo2.pdf no funcionaba con la versión anterior, así como tampoco reveal_files *.pdf. Con la actualización de hoy (añadido una comprobación de si el archivo comienza con el carácter “/”), se añade el camino al path actual en el momento de llamar la utilidad.

Otra forma de utilizarlo es utilizar la utilidad find de forma intermedia:

reveal_files $(find $(pwd) -iname "*.pdf")

Al pasar $(pwd) como primer argumento a find todos los path van a empezar for “/”, y la búsqueda con -iname es insensible a mayúsculas/minúsculas. Esta fórmula sí era compatible con la versión anterior del script, pero también se puede utilizar con la actualizada.

#AppleScript #bash #Finder #osascript #scripting #TerminalApp #zsh
Introduction to AppleScript Language Guide

Defines the AppleScript scripting language. Includes many brief sample scripts.

Trigger Sequences - Keybindings

A trigger that requires a sequence of multiple keypress events.

Ghostty

I just discovered (noticed, someone else has probably already documented this) that pressing Command+Up and Command+Down in the Mac Terminal app jumps between each point in your window buffer where you entered input!

All those times I got screenfuls of output, I could have used that keyboard command to navigate that context. 🙃

#macOS #KeyboardCommands #TerminalApp

Terminal.app on Tahoe (mac os 26 niceties edition)

In all the things that I don’t like about Liquid Glass, I forget to celebrate the things that make Apple great – continuous improvements to core features that make the Mac great. Terminal is my favorite terminal emulator app. I know there are better terminal apps out there in the form of ghostty and kitty. However, I haven’t found any of them really do what I want better.

I am keeping an eye out for rust based apps though. The performance improvements for those are very real and very felt even in the modern Apple silicon.

At any rate, I love that terminal now supports full 24-bit color. Yet another reason for me to not additional bloat to my system.

#apple #design #liquidGlass #mac #macOs #macOs26 #tahoe #terminalApp #utilities #visualDesign

🚀 Behold! Another terminal app to read your eBooks while simultaneously berating you with robotic text-to-speech—because reading was just too mainstream. 🤖👀 Clearly, the world was desperately waiting for the privilege of listening to their eBooks in the nostalgic style of a 90s dial-up modem. 📚💻
https://github.com/superstarryeyes/lue #terminalapp #ebookreader #texttospeech #nostalgia #techhumor #90sretro #HackerNews #ngated
GitHub - superstarryeyes/lue: Terminal eBook Reader with Text-to-Speech

Terminal eBook Reader with Text-to-Speech. Contribute to superstarryeyes/lue development by creating an account on GitHub.

GitHub
macOS 26: Erstes Redesign der Terminal-App seit Jahrzehnten
Die Terminal-App auf dem Mac ist für viele vielleicht unsichtbar, doch für einige Nutzer:innen von unschätzbarem Wert. Mit der Veröffentlichung von macOS 26 erhält sie nun ein grundlegendes Redesign. Endlich stattet Apple die Termin
https://www.apfeltalk.de/magazin/news/macos-26-erstes-redesign-der-terminal-app-seit-jahrzehnten/
#Mac #News #Apple #Farbdesign #LiquidGlass #MacOS26 #MacOSUpdate #PowerlineFonts #TerminalApp #WWDC25
macOS 26: Erstes Redesign der Terminal-App seit Jahrzehnten

Apple bringt mit dem Terminal-App Redesign frischen Wind in die Mac-Anwendung. Entdecke die neuen Features und Vorteile.

Apfeltalk Magazin
Using Warp as PowerShell terminal http://dlvr.it/TJGHff via PlanetPowerShell #Warp #PowerShell #WindowsTerminal #TerminalApp
PowerShell is fun :)Using Warp as PowerShell terminal

This week, after the official Windows release of Warp on February 26th, I saw many YouTube clips of the new Terminal app. I decided to try it and see what it does differently from my trusty Windows…

PowerShell is fun :)
Using Warp as PowerShell terminal http://dlvr.it/TJFFvJ via PlanetPowerShell #PowerShell #WarpTerminal #WindowsTerminal #TerminalApp
PowerShell is fun :)Using Warp as PowerShell terminal

This week, after the official Windows release of Warp on February 26th, I saw many YouTube clips of the new Terminal app. I decided to try it and see what it does differently from my trusty Windows…

PowerShell is fun :)

Quick tip for #macOS users (so you won’t feel as stumped as I did):

If you’re migrating to a new Mac, and you use the command line, remember to give #TerminalApp full disk access via System Settings > Privacy & Security.

Without this, you’ll run into errors which seem utterly obscure in the context of a UNIX shell. For example, I got an “Operation not permitted” error when trying a simple ‘ls’ in a folder for which I have full access permissions. 😬

With full disk access, all's well again. 😮‍💨

Graphical modern browser in terminal, is on the road.
Impressive new render engine is comming : https://github.com/fathyb/carbonyl/issues/11#issuecomment-1429116527
#itsfoss #terminalapp

GitHub - fathyb/carbonyl: Chromium running inside your terminal

https://github.com/fathyb/carbonyl

Consider Sixel Support · Issue #11 · fathyb/carbonyl

I think this is an amazing project! The only problem are images and some UI elements that need some rendering. I think sixel might be the best alternative, it's pretty lightweight and has support o...

GitHub