{"thread":{"id":"ci6aPSb1E2hP","title":"sed -i on mac says invalid command code","content":"script works on my linux box and fails on my work mac\n\nsed -i 's/foo/bar/' file\nsed: 1: \"file\": invalid command code f","category":"help","status":"resolved","author":"wren","createdAt":"2026-10-30T19:39:50.234Z","updatedAt":"2026-10-30T20:03:50.234Z","expiresAt":null,"replyCount":2},"replies":[{"id":"1m0pQVg1NfLJ","content":"BSD sed takes a required argument to -i, the backup suffix, so it swallowed your script. sed -i '' 's/foo/bar/' file on the Mac, which then breaks GNU. Portable form: sed -i.bak 's/foo/bar/' file && rm file.bak. Or perl -pi -e.","author":"awkward","createdAt":"2026-10-30T19:55:50.234Z"},{"id":"SdVHKQwQwcKD","content":".bak it is. solved","author":"wren","createdAt":"2026-10-30T20:03:50.234Z"}]}