rockyourcode: TIL: How to Fix ”Cannot Read Termcap Database” With Tmux and Kitty on Macos, and more
Hello 👋! Thanks for subscribing.
I've started my first job in tech last week, so I wasn't able to write a blog post every day.
TIL: How to Fix ”Cannot Read Termcap Database” With Tmux and Kitty on Macos
Published on: 2021-07-03
tags: TIL, MacOs, Tmux, DevTools
The Problem
I use the Kitty terminal emulator with Tmux as my main tool for working with code.
My Tmux settings (~/.tmux.conf
) contain the following lines to enable true-color-support:
# true colors
set -g terminal-overrides ',xterm-256color:Tc'
set -g default-terminal "tmux-256color"
set -as terminal-overrides ',xterm*:sitm=\E[3m'
When I open tmux on MacOs I get the following error message:
Cannot read termcap database;
using dumb terminal settings.
The Solution
macOS has ncurses version 5.7 which does not ship the terminfo description for tmux.
Download terminfo
provided by the tmux maintainers:
curl -sSL https://gist.github.com/nicm/ea9cf3c93f22e0246ec858122d9abea1 > tmux-256color
Compile tmux-256color
terminal info:
/usr/bin/tic -xe tmux-256color terminfo.src
Verify that terminfo
returns the correct value (it should not be null
):
infocmp -x tmux-256color
Links
Notes on “Hashnode Talks: Saas, Software Engineering and Social Media With Simon Høiberg“
Published on: 2021-07-02
tags: Lab, Notes
Simon started his career in selling software. As he learned more about the world of software, he gradually transformed into a software developer and freelance consultant.
Simon build a SaaS product last year. Here is what he learned from trying to build an audience:
About Building an Audience
He spend a month on trying to understand his audience without trying to sell anything. His focus was on being helpful and consistently offering help.
He's giving away 90% of his content for free, and asks for money far down the road.
The first 500 followers are the hardest. Social proof helps you as soon as you overcome the initial bump.
Simon's top tips for starters:
- provide actionable value
- don't ask for anything in return
- post content consistently
- focus 75% of your effort on engaging with your audience
- follow big social media accounts, and provide value there without copying the content, show respect
There will be haters on social media. Don't feed the trolls. Prepare for the critics.
About Building a SaaS Business
Simon build the tool that he wanted to see (scheduling social media posts). He build a small open-source application first.
He build a MVP and found people interested in the product via Twitter. Then he constantly sought feedback and improved the product.
He's now bootstrapping the business. As a founder, you might need to dog-food the business, as it might not be profitable yet.
On social media, you'll see a lot of success stories. But often you don't see the hard work that happened before the "overnight success".
Links
I Started My New Job (And Have MacOS Woes)
Published on: 2021-07-01
tags: Lab, Unix, MacOs
Today I started my first job in tech.
While I'm pretty excited, it's a big step.
I have to learn new workflows and tools (Jira) and become familiar with a new code-base (Angular nx workspace).
Plus, I now have a Mac for work. I underestimated the differences between my Linux box and MacOs.
As terminal user with lots of scripts and shell modifications, I heavily rely on my dotfiles.
I came to the realization that my files are not as portable as I've thought.
Currently, my problem is that the Linux $HOME
folder is /home/username
while MacOs uses /Users/username
.
The fish shell seems unable to expand the $HOME
variable. It uses the absolute path, which is not portable to MacOS, as the $HOME
directory is at a different location.
Example output of echo $fish_user_paths | tr " " "\n" | nl
(shows the PATH
variables):
1 /home/myusername/.bin
2 /home/myusername/.deno/bin
For Mac it need to be:
1 /Users/myusername/.bin
2 /Users/myusername/.deno/bin
My idea was to replace all hard-coded values with the $HOME
variable.
1 $HOME/.bin
2 $HOME/.deno/bin
This does not work with Fish shell.
I haven't found a solution yet.
Edit: I've created a symbolic link for /Users/myusername
to /home/myusername
.
sudo vim /etc/auto_master
# add a "#" at the start of the line beginning with /home
# save changes
sudo automount -cv
sudo ln -s /Users/myusername /home/myusername
I've found this solution on StackExchange.
TIL: How to Remove Headers From ps Command on MacOs
Published on: 2021-06-30
tags: TIL, Unix, MacOs
Today I've started to setup my MacBook Pro for work. It's my first Mac and I'm not amused.
If you only know Linux, there are some pitfalls.
My .bashrc
script contains the following lines:
#
# ~/.bashrc
#
# Fish
if [[ $(ps --no-header --pid=$PPID --format=cmd) != "fish" ]]
then
exec fish
fi
I use bash
as my login shell, but fish
as my main interactive shell. Fish is not POSIX-compliant which can lead to problems.
This will allow Bash to properly source
/etc/profile
and all files in/etc/profile.d
. Because fish replaces the Bash process, exiting fish will also exit the terminal. Compared to the following options, this is the most universal solution, since it works both on a local machine and on a SSH server.
The command starts a shell inside bash
, but drops into fish
. When you use the fish
shell, but want to bail out to bash
, you can type bash
into the prompt.
Unfortunately, the command relies on the GNU implementation of ps --no-headers
. MacOs ships with the BSD variant of ps
.
Workaround:
if [[ $(ps -p $PPID -o command | tail -n +2) != "fish" ]]
then
exec fish
fi
Now we use the -o
option:
-o
Display information associated with the space or comma sepa-\ rated list of keywords specified. Multiple keywords may also\ be given in the form of more than one -o option. Keywords may\ be appended with an equals (`=') sign and a string. This\ causes the printed header to use the specified string instead\ of the standard header. If all keywords have empty header\ texts, no header line is written.
Links
How to Build Any Kind of App by Andrea Bizzotto
Published on: 2021-06-29
tags: Lab, Notes
Here are some quick notes on the video How to build any kind of app in Flutter (and overcome Tutorial Hell) by Andrea Bizzotto.
Learn solid fundamentals first.
Try to pinpoint the most challenging features. Read the documentation and create a mental map of the features you need.
Build one feature at a time.
Find tutorials and examples for a feature, experiment with the code, re-assemble it.
Instead of searching for more tutorials, improve the existing solution with what you learned from the documentation.
Every app is different, and you will always encounter things you don't know. Don't focus on "how to build app X".
Focus on the fundamental techniques and design patterns for building (mobile) apps.
Don't copy-paste code, ask yourself:
- is this answer a good match?
- does it fit well in my code?
- do I need to tweak/rewrite this code?
- will it work for all edge cases?
- do I understand this code completely?
Aim for deeper knowledge.
Links
- How to build any kind of app in Flutter (and overcome Tutorial Hell) by Andrea Bizzotto
- Written guide to above video
Thank you for reading my blog.