Author: erics, Posted on Friday, March 7th, 2025 at 6:20:45am
If you’re a Vim user and want to integrate Prettier for automatic code formatting, follow these steps to set it up on your system.
Install Prettier Globally
Before installing the Vim plugin, you need to have Prettier installed globally via npm:
1
2
sudo dnf install npm-y
npm install-gprettier
Install vim-prettier Plugin
To use Prettier inside Vim, install the vim-prettier plugin. Clone the repository into your Vim plugin directory:
1
2
3
mkdir-p~/.vim/pack/plugins/start
cd~/.vim/pack/plugins/start
git clonehttps://github.com/prettier/vim-prettier
Enable Plugin in Vim
Ensure that Vim loads the plugin by adding the following line to your ~/.vimrc file:
1
packloadall
Format Code in Vim
You can now invoke Prettier inside Vim using the command:
1
:Prettier
This will format your current file based on Prettier’s default rules or your .prettierrc configuration.
Final Thoughts
With this setup, you can seamlessly format your code within Vim using Prettier, making your workflow more efficient and consistent. Happy coding!
Author: erics, Posted on Wednesday, March 5th, 2025 at 6:30:55am
Bracketed paste is a feature in modern shells that helps prevent accidental execution of pasted commands by wrapping them in special escape sequences. However, some users find this behavior annoying, especially when pasting multi-line commands. Fortunately, it’s easy to disable bracketed paste in both BASH and ZSH.
Disabling Bracketed Paste in BASH
To turn off bracketed paste in BASH, modify your ~/.inputrc file by adding the following line:
1
set enable-bracketed-paste off
You can apply this change immediately by running:
1
bind-f~/.inputrc
Otherwise, restart your terminal or open a new session for the changes to take effect.
Disabling Bracketed Paste in ZSH
For ZSH users, disable bracketed paste by adding the following line to your ~/.zshrc file:
1
unset zle_bracketed_paste
After saving the file, reload your ZSH configuration with:
1
source~/.zshrc
Bonus: Enhancing TAB Completion
If you’re customizing your shell, consider tweaking TAB completion behavior to improve your experience. Add these lines to ~/.inputrc for a more intuitive tab completion experience:
1
2
3
4
set bell-style none
set completion-ignore-caseon
set show-all-if-ambiguous on
TAB:menu-complete
After modifying ~/.inputrc, apply the changes with:
1
bind-f~/.inputrc
### Explanation of TAB Completion Tweaks:
set bell-style none – Disables the terminal bell sound.
set completion-ignore-case on – Makes tab completion case-insensitive.
set show-all-if-ambiguous on – Displays all possible completions when multiple matches exist.
With these tweaks, you can optimize your shell experience and eliminate unwanted behavior while improving command-line efficiency!
Extra Bonus: Dynamic Terminal Title
Sometimes my Terminal title gets stale, so I wanted a command to dynamically set it to the hostname and current working directory.
1
2
3
4
5
6
shell%vi setprompt
#!/bin/bash
export SHORTHOST=`hostname-s`
printf"\033]0;${SHORTHOST}:${PWD}\007"
shell%chmod755setprompt
shell%./setprompt
This will set your terminal title to display the short hostname and current working directory, making navigation easier when working across multiple terminals.
Author: erics, Posted on Monday, March 3rd, 2025 at 9:52:06am
If you’ve ever encountered a scenario where Safari on macOS Sonoma cannot reach a local or internal web service (while Firefox and curl work just fine), the issue may be due to Apple’s strict security features. Specifically, iCloud Private Relay and the Hide IP Address from Trackers option can interfere with certain local network connections.
This blog post will walk you through how to disable these settings to restore proper connectivity.
Issue: Safari Cannot Access Internal or Local Services
In my case, Safari was unable to reach a local project listening on port 8000 on the same FQDN while Firefox and curl could access it without issue. If you’re facing a similar problem, read on!
Solution 1: Disable iCloud Private Relay
Private Relay is an iCloud+ feature that reroutes your internet traffic through Apple’s servers, potentially blocking access to local network services.
Here are the steps to disable Private Relay:
Go to System Settings → Click on your Apple ID (top-left corner).
Select iCloud.
Scroll down and locate Private Relay.
Toggle Private Relay Off.
Click Done and restart Safari.
Solution 2: Disable “Hide IP Address from Trackers”
Safari’s Hide IP Address from Trackers setting can also interfere with local connections by modifying how network requests are sent.
Here are the steps to disable Hide IP Address:
Open Safari → Settings.
Navigate to the Privacy tab.
Uncheck “Hide IP Address from Trackers”.
Conclusion
If you’re experiencing Safari connectivity issues on macOS Sonoma while other browsers work fine, disabling Private Relay and Hide IP Address might be the fix you need. These settings, designed to enhance privacy, can unintentionally block local services and internal network access. By making these adjustments, Safari should function as expected.
If you found this guide helpful, let me know in the comments!
Author: erics, Posted on Sunday, March 2nd, 2025 at 8:19:01am
If you have multiple ~/bin/ directories across different hosts and want to consolidate them into a single Git repository hosted on your own Git server, follow these steps.
1. Create a New Bare Git Repository on Your Git Server
First, log in to your Git server and create a new repository:
1
2
3
4
mkdir-p/path/to/git/repos/bin.git
cd/path/to/git/repos/bin.git
git init--bare
chown-Rgit:/path/to/git/repos/bin.git
This repository will serve as the central location for all your ~/bin/ directories.
2. Initialize a Local Git Repository on the First Host
Author: erics, Posted on Wednesday, February 26th, 2025 at 7:59:58am
With macOS Sonoma, Apple changed the way Mission Control displays virtual desktops, reducing them to small slivers that require hovering to expand. If you prefer the previous behavior—where the full desktop bar opened automatically—there’s a simple solution using a third-party tool.
How to Restore the Full Desktop Bar in Mission Control
Follow these steps to bring back the full desktop bar when using Mission Control:
Download and Install MissionControlFullDesktopBar.app
The open-source MissionControlFullDesktopBar.app restores the expanded desktop bar in Mission Control.
Locate the downloaded .zip file in your Downloads folder.
Double-click the .zip file to extract MissionControlFullDesktopBar.app.
Move MissionControlFullDesktopBar.app to the /Applications folder by dragging and dropping it.
Grant Full Disk Access to Shortcuts
For the app to work properly, ensure Shortcuts has the necessary permissions:
Open System Settings from the Apple menu.
Navigate to Privacy & Security.
Scroll down and select Full Disk Access.
Click the + (Add) button at the bottom of the list.
Navigate to Applications, select Shortcuts.app, and click Open.
Ensure that Shortcuts is toggled ON in the Full Disk Access list.
Assign Fn + Up Arrow to Open the App
To make launching Mission Control with the full desktop bar seamless, use the Shortcuts.app to assign a keyboard shortcut:
Open Shortcuts.app on your Mac.
Click the + (Create Shortcut) button to create a new shortcut.
In the right panel, search for Open App and drag it into the shortcut workflow.
Click App in the newly added action, then choose MissionControlFullDesktopBar.app from the list.
Click the Settings (i) button in the top-right corner of the shortcut window.
Click Add Keyboard Shortcut, then press Fn + Up Arrow.
Close the settings and Save the shortcut.
Once set up, pressing Fn + Up Arrow will launch Mission Control with the full desktop bar, bringing back the experience many users prefer.
With this simple tweak, you can enjoy Mission Control as it was meant to be—giving you quick and easy access to all your virtual desktops without the extra hover step.
Author: erics, Posted on Monday, February 10th, 2025 at 3:02:57pm
I needed to get all files in a bucket readable by the public easily.
Here is the S3 Bucket Policy I applied:
1
2
3
4
5
6
7
8
9
10
11
12
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"PublicReadGetObject",
"Effect":"Allow",
"Principal":"*",
"Action":"s3:GetObject",
"Resource":"arn:aws:s3:::BUCKET_NAME_HERE/*"
}
]
}
To do this via the aws cli command, create the file s3_read_policy.json containing the policy above, with your bucket name in place of BUCKET_NAME_HERE:
Author: erics, Posted on Saturday, February 8th, 2025 at 7:28:01am
If you’re using macOS 14.7.3 and experiencing an annoying issue where clicking a running app’s icon in the Dock doesn’t immediately make it active for typing, you’re not alone. Instead of the expected behavior—where the app comes to the forefront, ready for interaction—you might find yourself having to click inside the app’s window before you can start working. This extra step is frustrating and unnecessary.
The Problem: App Selection Requires a Second Click
When you select a running app by clicking its Dock icon, the expected behavior is that the app window becomes active immediately. However, on macOS 14.7.3, some users have found that the focus remains on the previous application, requiring an additional click inside the newly selected app’s window before they can start typing. This can slow down workflow and make switching between applications feel sluggish.
The Fix: A Simple Terminal Command
Fortunately, there’s a quick and effective fix using the Terminal. Running the following command will ensure that clicking an app in the Dock makes its window active immediately:
1
defaults write com.apple.dock single-app-boolfalse;killall Dock
Step-by-Step Guide to Apply the Fix
1. **Open Terminal:** You can find it in Applications > Utilities > Terminal, or simply search for “Terminal” using Spotlight (Cmd + Space).
2. **Enter the Command:** Copy and paste the following command into Terminal:
1
defaults write com.apple.dock single-app-boolfalse;killall Dock
3. **Press Enter:** This will apply the changes and restart the Dock automatically.
4. **Test the Fix:** Click on a running app’s Dock icon and verify that its window becomes active immediately.
Why This Works
macOS includes a hidden setting called single-app mode, which, when enabled, modifies how the Dock handles app switching. Some users might inadvertently have this setting turned on, causing the behavior described above. Running the command above explicitly disables this setting, restoring normal functionality.
Additional Troubleshooting
If the issue persists after running the command, consider the following additional steps:
– Restart your Mac to ensure all changes take effect.
– Check **System Settings > Desktop & Dock** and make sure the following options are enabled:
– “When switching to an application, switch to a Space with open windows for the application.”
– “Group windows by application.”
– If the issue only occurs with specific apps, try quitting and reopening them or reinstalling them.
Conclusion
By running a simple Terminal command, you can restore the correct app-switching behavior on macOS 14.7.3 and eliminate the need for extra clicks when selecting apps from the Dock. This fix helps streamline workflow and ensures a smoother user experience.
Have you encountered this issue before? Let us know in the comments below if this fix worked for you or if you found alternative solutions!
Author: erics, Posted on Friday, January 17th, 2025 at 9:20:32am
Have you ever found yourself frustrated when copying and pasting commands in the Apple terminal no longer behaves as expected? If you used to work with Bash on older macOS versions, you might recall that pasting a command into the terminal automatically executed it—no extra steps required. However, with the switch to Zsh as the default shell in newer macOS versions, this behavior has changed. Now, pasting doesn’t automatically press return, and that can feel like an unnecessary hurdle.
The reason for this change lies in how Zsh and terminal emulators handle pasted content. Specifically, it’s due to a feature called bracketed paste mode, which prevents commands from executing immediately upon being pasted. While this feature is useful for security and preventing accidental execution, it’s not always convenient. Fortunately, you can adjust Zsh to restore the old behavior and automatically press return after a paste.
If you’d like to go back to the simpler behavior of pasting and executing commands automatically, you can disable bracketed paste mode. This reverts Zsh to behave more like Bash in this regard.
Here’s how to disable Bracketed Paste Mode:
Open your .zshrc file in a text editor:
1
vi~/.zshrc
Add the following line to disable bracketed paste mode:
1
unset zle_bracketed_paste
Save the file and reload your configuration to apply the change:
1
source~/.zshrc
With this change, Zsh will no longer block the automatic execution of pasted commands.
By following these steps, you can bring back the seamless pasting experience you enjoyed with Bash. Whether you’re writing scripts, testing commands, or just trying to save time, this small adjustment can make a big difference in your workflow. Happy coding!