https://github.com/minimaxir/miditui #musicianlife #programming #terminalapp #HackerNews #ngated
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.
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. 🙃
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
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. 😮💨